home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
csr20doc.arc
/
CSR.DOC
Wrap
Text File
|
1987-01-11
|
265KB
|
14,059 lines
C Spot Run
A User-Supported C Add-On Library
Version 2.0
January 10, 1987
Bob Pritchett
New Dimension Software
23 Pawtucket Dr.
Cherry Hill, NJ 08003
Copyright 1986, 1987 Bob Pritchett
All Rights Reserved
To Mom and Dad
Your time, effort, encouragement and advice
have been far above and beyond what any
son could dream of asking.
Trademarks
MS-DOS and Microsoft C are trademarks of Microsoft Corporation.
IBM-PC is a trademark of International Business Machines.
C Spot Run is a trademark of New Dimension Software.
C86 is a trademark of Computer Innovations, Inc.
Lattice is a trademark of Lattice, Inc.
Disclaimer
This library and all of its contents are provided "AS IS."
No warranty is expressed or implied. Use of this library is at
the user's own risk, and the authors are not liable for any
damages or loss of profits resulting from the use of the library
or its documentation.
C Spot Run - Documentation
Table of Contents
Dedication............................................... 2
Trademarks............................................... 2
Disclaimer............................................... 2
1. Introduction............................................. 5
1.1. What is C Spot Run?................................. 5
1.2. Why C Spot Run?..................................... 5
2. Obtaining and Copying C Spot Run......................... 6
2.1. User Supported Software............................. 6
2.2. Ownership of C Spot Run............................. 6
2.3. Contents of C Spot Run.............................. 6
2.4. License for C Spot Run.............................. 6
3. Using the C Spot Run Library............................. 8
3.1. Using the Library with Your Compiler................ 8
3.2. Modifying the Library............................... 8
3.2.1. Problem Areas................................ 8
3.2.2. Helpful Suggestions.......................... 8
3.3. Using the Utilities and Aids........................ 9
4. Format of Routine/Utility Descriptions................... 10
4.1. How to Use Routine Description Pages................ 10
4.2. How to Use Utility Decription Pages................. 10
5. The Library Routine Descriptions.........................
5.1. General Descriptions of Related Routines............
5.1.1. Date Manipulation Routines...................
5.1.2. Directory Management Routines................
5.1.3. Graphics Routines............................
5.1.4. Input Routines...............................
5.1.5. Printer Operation Routines...................
5.1.6. Real Time Timers.............................
5.1.7. Window Function Library......................
5.2. Individual Routine Descriptions.....................
6. Utility and Aid Descriptions.............................
7. Header File Descriptions.................................
8. Appendix A - Updating the Library........................
9. Appendix B - Contacting Authors..........................
10. Appendix C - Submitting Routines or Utilities............
11. Appendix D - Library History and Changes.................
12. Appendix E - ASCII Table.................................
13. Appendix F - Window Border Characters....................
Page 3
C Spot Run - Documentation
14. Quick Reference Chart....................................
15. Routine/Utility Submission Form..........................
16. User Response Form.......................................
17. Order Form...............................................
Page 4
C Spot Run - Documentation
1. Introduction
1.1. What is C Spot Run?
C Spot Run is a library of C and Assembly routines for C
programmers. These routines supplement the standard libraries
provided with compilers, and provide tools for specialized
applications.
All routines in this library are either in the public domain
or are part of the user supported software world, as are the
accompanying utilities and programming aids.
Our goal is to provide low cost (free!) routines and
utilities for C programmers. The use of pre-written routines
greatly reduces the amount of tedious code writing in almost any
situation, and we hope that our collection will prove to do so.
1.2. Why C Spot Run?
What is probably the next question to cross your mind is
simply, why? Good question, and I hope this is a good answer.
Because. Because there are so many libraries similar to this
one. Because they all cost money, and this one doesn't. Because
as of yet there is no central distribution point for many of the
C routines floating around in .C files everywhere. We feel that
C Spot Run is filling a need, and we hope you agree with us.
We would appreciate your taking some time to let us know
what you think of the library and what directions you would like
to see it take.
Page 5
C Spot Run - Documentation
2. Obtaining and Copying C Spot Run
2.1. User Supported Software
User supported software is software distributed at no cost
other then a small media charge with the expectation that those
who find it useful will send a donation to support the
development. In most cases those who contribute become
registered users and receive automatic updates, printed manuals,
telephone support, and/or source code.
2.2. Ownership of C Spot Run
Without a major essay on copyright laws, the routines and
utilities in this package are the property of their respective
authors, with the exception of those released to the Public
Domain (PD). It is important to recognize the difference between
Public Domain and user-supported software. (User-supported
includes "ShareWare", "FreeWare" and several other names.)
Unlike authors who totally give their software to the public
domain, some authors distribute their code with a limited
license, usually something to the effect that you are not to
distribute modified versions or charge for the distribution.
The routines and utilities in this library are either
totally in the public domain, in which case their source code is
present, or have been released to this library for distribution
as described in Appendix C of this document.
As to the library itself, and this documentation, they are
property of Bob Pritchett, and released to the public under the
limited license in section 2.4.
2.3. Contents of C Spot Run
The very basic principle behind this library is user-
supported software. In addition to monetary contributions, an
even more valuable form is that of routines or utilities. Most
of the routines and utilities in this library were written by two
or three people, or are modifications of other routines in the
public domain.
We would like to build a sizable library of tools and helps
for C programmers, and whether it is a new routine you wrote, or
one that is already in the public domain world, your contribution
of code and permission to let us use it would be appreciated.
At present this library is a collection of routines and
programming aids only. Since the release of the first version of
the library, the response has been positive, and our
interpretation of it is that the library should continue to focus
on routines and programming aids, as opposed to creating a
library of general C source code.
2.4. Distribution License for C Spot Run
The C Spot Run library of routines and utilities may be
freely duplicated and distributed under the following terms:
Page 6
C Spot Run - Documentation
o No fee may be charged other than reasonable expenses for
media and reproduction, no more then eight dollars.
o The library MAY NOT be distrbuted by any for-profit
corporation, including, but not limited to, for-profit public
domain software companies, without the express written permission
of Bob Pritchett.
o The routines, utilities, and documentation are not to be
distributed in a modified form.
o The routines and utilities are not to be used in
commercial applications or business environments without the
express written permission of the authors.
o Credit must be given to authors whose routines are used
in any distributed application, in both the code and program
documentation, unless other arrangements are made directly with
the author.
Page 7
C Spot Run - Documentation
3. Using the C Spot Run Library
3.1. Using the Library with Your Compiler
All utilities included in this library work with straight
ASCII text files, unless otherwise specified, and those dealing
with the syntax of the C language should work with all flavors of
C that conform to the basic guidelines in K&R.
The routines are distributed in several forms, usually
either object code or source code, C or assembly. Specific
information on each routine and it's compiler dependancies is
available in the section entitled Compiler Specifics in each
routine entry. As a general rule, object code and libraries are
in the Microsoft/Lattice format. These libraries and object code
modules can be linked to your program with LINK. If the source
code is available simply check it for compiler differences (see
the next section) and compile it with whatever compiler you use.
3.2. Modifying the Library
Although many compilers use the same routines, they often
are named differently, or use a different set of parameters.
This section should be of assistance in modifying source to work
with your, or someone else's, compiler. If you have some
information that could be helpful in ocmpiler conversions, please
contact us.
3.2.1. Problem Areas
Some of the more common differences in compiler libraries
are the naming conventions used. For instance, the routines to
perform a DOS interrupt vary from intdos() to doint(), and have
just as many differences in parameters. Some common differences
are in string manipulation, hardware specific functions, and
memory management. Here is some information that should be of
help:
3.2.2. Helpful Suggestions
Those with Microsoft C V3.0 should consult the header file
V2TOV3.H for assistance, and Appendix D of the User's Guide,
Converting from Previous Versions of the Compiler.
Microsoft V3.0 uses unions declared in DOS.H as parameters
for it's hardware/DOS functions unlike most other compilers which
need the register variables etc. declared by the user. The
register variables are stored in a union of type REGS, and are
addressed using the union member x to access registers with x as
a second character, or h to access the registers ending in h or
l. Example: union REGS in; n = in.x.ax; y = in.h.bl;
Microsoft's hardware interrupt is int86(int,&in,&out), cor-
responding to sysint(int,&in,&out) used by many other compilers.
Likewise intdos(&in,&out) corresponds to sysint(0x21,&in,&out).
Page 8
C Spot Run - Documentation
Lattice/Computer Innovation's movmem(source, destination,
width) corresponds to Microsoft's movedata(destination, source,
width).
All of Microsoft's string manipulation functions are in the
format strxxx() or strnxxx(). Example: strlwr(string)
strcat(string1, string2) strncat(string1, string2, number).
3.3. Using the Utilities and Aids
The use of utilities and programming aids should be clearly
described on their description pages. All include files should
be included at the beginning of sources that need them, and in
addition to the description page most independant utilities will
provide a short summary of their use when run with no command
line parameters.
Page 9
C Spot Run - Documentation
4. Format of Routine/Utility Descriptions
4.1. How to Use the Routine Description Pages
The routine description pages are set up in such a manner
that updates to the library will not require a totally new
manual.
Each routine has its own full page regardless of how small
or large it is. The page is set up in a special order, with the
name of the routine on the upper right of the page at the top for
quick indexing, followed by a short summary of the necessary
arguments and their data types. Next is a line containing the
creation and last update dates, and then the author's name and
whether the source is in C or Assembly. Following these is a
list of the files in which the code is contained, a list of other
required functions that may not be in every library, and then a
paragraph description of the function. This is followed with a
paragraph explaining any ties to one specific compiler, the
return value, a list of related functions in the library, and a
final example of how it might be used in a portion of code.
It is recommended that you keep the complete manual in a
three ring binder, and as you receive updates simply print out
the enclosed page, and insert it in alphabetical order among the
function description pages. (This manual may seem like a waste
of paper, but this way it saves a lot in the long run.)
4.2. How to Use the Utility Description Pages
The utility description pages are similar to the routine
descriptions described above except for the layout of
information. On the utility description pages the first item is,
as with the routine descriptions, the utility name on the upper
right hand corner. Next is a summary of the utility including
the creation and last update dates, the author's name, the source
language, and then a copy of the documentation, usually an exact
duplicate of whatever documentation the author has sent.
As mentioned, the method for updating these description
pages is the same as above in section 4.1.
Page 10
Date Manipulation Routines
This library comes with a variety of routines that can be
used to perform operations on and manipulate dates.
When calling functions that require date elements the order
of month, day, and year is used. The only exceptions to this
ordering are the get_date() and set_date() functions, which work
with the system's internal date. These routines require the
arguments to be in the order of day, month, and year.
All of the date manipulation routines are capable of
accepting years in both the two and four digit formats. (IE.
1987 is evaluated in the same manner as is 87.)
The number of days between two given dates can be calculated
directly with the dt_diff() routine, or through subtraction using
the serial numbers of each date, as calculated with date_sn().
At present the date routines do not take into account
different calendar systems, and, with the exception of the year
limited serial number routines, will assume all AD dates are in
our current system.
Directory Management Routines
With the two basic file search routines ffirst() and fnext()
any number of directories may be generated, and when combined
with the windowing routines any application can have a convenient
system for directory viewing and file selection.
The possibilities are endless, thus only a limited number of
directory viewing routines have been provided, but we trust that
they will help you design and implement whatever file management
you require. The following are some hints and suggestions:
Finding and storing all the file names before displaying
them has the benefit of allowing scrolling to take place forwards
and back, but the disadvantage of a slight delay while reading in
the information. If scrolling is needed, try saving the names as
they are read and displayed, and keep pointers allowing you to
scroll back, but not forward until the new file names are read.
If it is neccessary to divide the file name and extension
two obvious alternatives are presented. Either write a routine
to go through the string containing the name, looking for the dot
separater, and split the string into two parts, or use the
sscanf() function to read the two fields into separate strings.
Whatever you do with the provided directory routines, we'd
appreciate a copy of your routine for curiosity's sake, and if
possible, inclusion in a future version of the library.
Graphics Routines
This version of the library contains just a few simple
graphics primitives that work with the Color Graphics Adapter.
The routines provided perform simple graphics functions with no
concern for the aspect ratio of the screen, relative coordinates,
etc. All of the functions work with the exact coordinates given
and mathamaticly calculated assuming an aspect ratio of one.
(The IBM PC has a ratio of 1.2.)
The purpose of these routines is to provide a very few basic
routines for some form of graphics output. If you have a
complete graphics system, or just one that's faster than that
provided here, we would appreciate it if you would consider
submitting a copy to the library.
Input Routines
The input routines are named in the following format:
[w][f]inpt<type>[r][m][e][d]();
[w] Window. If input is in a window, use the [w]
prefix. NOTE: If the window pointer given is not to a valid
window the result is undefined.
[f] Field. Field input is input in a maximum
length field. The color and fill character for the field is
specified by fcolor() and fchar().
<type> Type. This mandatory part of the function
name is the type of input being accepted.
[r] Range. If there is a minimum and maximum
entry this element is used in the name.
[m] Mask. This element means that an input mask
will be specified.
[e] Editing. If the field supports full editing
features, this element is used.
[d] Default. If there is to be a default entry
this element is used.
All of these elements make for a large number of possible
routines. However, only a few of these options are implemented,
and users who have source code can use these functions as bases
for new ones. For a list of which functions have been
implemented with this version, please check the quick reference
chart at the end of the manual.
Printer Operation Routines
The printer output routines included in this verson, 1.0, of
the library are intended to provide only the basics for printer
control. The routines provide for single character output,
lputchar(), string output, lprint(), and formatted string output,
lprintf().
These routines all call DOS function number 5 which means
that with the DOS MODE command etc. the output can be redirected
or reformatted.
Many libraries include an extensive set of routines to set
different attributes, fonts, and styles on printers. However,
since these routines are usually dependant on one printer make,
and generaly do little more then output two or three characters
it was thought best to provide only the generic lputchar()
function. If you would like to provide a set of printer specific
or independant routines to perform these functions, please
contact us.
Real Time Timers
The timer functions are designed to implement up to ten
different elapsed time counters. The counters are numbered from
zero to nine, each of which may be individually started, stopped,
and read. The function init_tmr() must be called before any of
the timers are used, although it needs to be called only once.
These ten counters may prove especially useful in
communications, timed input, or other 'real time' applications
due to the fact that they work with the internal system clock and
are not bus clock rate dependant. (The timer() routine, not a
part of this collection, does report in clock ticks.)
All of the timer functions, with the exception of init_tmr()
and get_timer(), require a single integer argument with a value
between zero and nine. Any other value will normalized into that
range, which is the timer to use for that specific function call.
The functions that return a time do so in tenths of seconds.
(The maximum time any timer may track is approximately 1.8
hours.)
These routines were contributed by Dave Perras who wrote
them with a Datalight C compiler. The included source code
should be easily portable to most MS-DOS C compilers.
Window Function Library
The C Spot Run window function library is a library of
routines that perform background/foreground windowing. What this
means is that any window that is overlapped by another window,
when addressed for output, will be moved to the front of the
'stack' and become the active window.
The window library also contains a large number of support
routines to make movement of and output to windows as easy as
possible. There are routines that make pop-up menus, center
text, draw boxes, and do much more. Full color support is
available, and for speed all of the cursor and output functions
are in assembly.
All windowing functions are in the file COUTPUT.OBJ, and
source is not distributed.
For ease of calling, in general you will find that all
window functions are preceeded by a w in the function name,
(wopen(), wclose(), etc.) and in most cases the first argument is
the window pointer.
For more information, consult the detailed function
descriptions.
I would like to thank Philip A. Mongelluzo whose Windows for
C and Window BOSS packages were of invaluable use to me in the
development of this package, not to mention the time he spent
patiently answering my questions.
border
Summary:
int border(color);
int color; /* Color of Border */
Created: 12/28/85 Last Updated: 12/28/85
Author: Bob Pritchett Source (C/A): A
Located in: BORDER.OBJ
Requires: Nothing.
Description:
This function draws sets the screen border to the specified color
using function 11 of the BIOS video interrupt.
Works in text modes only.
Compiler Specifics:
Has Microsoft's assembly header, otherwise none.
Return Value:
Nothing.
See Also:
Example:
border(4); /* Red Border */
box
Summary:
int box(x,y,x2,y2,type);
int x; /* Upper Left Row */
int y; /* Upper Left Col */
int x2; /* Lower Right Row */
int y2; /* Lower Right Col */
int type; /* Style of Border */
Created: 08/ /85 Last Updated: 05/22/86
Author: Bob Pritchett Source (C/A): C
Located in: BOX.OBJ
Requires: gotoxy() putch()
Description:
The box function draws a graphic box using the upper left and
lower right corner coordinates. The border style can be a
combination of the double and single line characters of the IBM
character set, or any other printable character used all the way
around. The border is chosen with type. If type is equal to
one, an all single line border is drawn. If it is two, a double
horizontal line and single vertical line is used, if it is three
it is an all double border, if it is four a single horizontal
line and double vertical line are used. In the case of a five,
three ASCII characters, + - |, are used. Any other value in type
will cause the border to consist entirely of this character.
Compiler Specifics:
BOX.OBJ was compiled using MSC 3.0, but there are no compiler
specifics involved other then putch(), the put character to
console function.
Return Value:
Returns a one if successful, or a negative one if invalid
coordinates are passed.
See Also:
cbox()
Example:
box(10,10,20,30,'*'); /* A box with a border of *'s */
cbcapt
Summary:
int cbcapt(flag);
int *flag; /* Location of Integer Flag */
Created: 10/26/86 Last Updated: 10/26/86
Author: Source (C/A): A
Located in: CBRKTRAP.OBJ
Requires: Nothing.
Description:
This function allows the programmer to detect and handle a
Control-C or Control-Break entered by the user. The function
must be called with the location of a static integer which will
be set positive when a Control-C or Control-Break is hit. The
program may then choose to test and handle the flag, or ignore it
totally, effectually disabling the break features.
This function is based on routines in Advanced MS-DOS and The C
Toolbox, by Ray Duncan and William Hunt.
Compiler Specifics:
None.
Return Value:
No return value.
See Also:
cbrest()
Example:
main()
{
static int flag = 0;
timer();
cbcapt(&flag);
while ( flag == 0 )
printf("Waiting for Ctrl-Break.\n");
printf("Control-Break detected after %ld clock ticks.\n"
,timer());
cbrest();
exit(0);
}
cbox
Summary:
int cbox(x,y,x2,y2,type);
int x; /* Upper Left Row */
int y; /* Upper Left Col */
int x2; /* Lower Right Row */
int y2; /* Lower Right Col */
int type; /* Style of Border */
Created: 03/03/86 Last Updated: 03/03/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: putchci() gotoxy()
Description:
This function is functionaly the same as box() except that the
box is drawn in the current color. It is primarily used as an
internal routine in COUTPUT.OBJ. For independant use, use color()
or wcolor() to set the color.
Compiler Specifics:
None.
Return Value:
Returns a one if successful, a negative one if invalid
coordinates are passed.
See Also:
color() wcolor() box()
Example:
#include <color.h> /* Just for the colors... */
color(RED_F,WHT_B); /* Red on White */
cbox(5,5,20,60,1); /* A box with a single line border */
cbrest
Summary:
int cbrest();
Created: 10/26/86 Last Updated: 10/26/86
Author: Source (C/A): A
Located in: CBRKTRAP.OBJ
Requires: Nothing.
Description:
This function disables the Control-C and Control-Break trapping
turned on by cbcapt(). While it is not always neccessary to call
this function before exiting a program, it is a good practice.
Compiler Specifics:
None.
Return Value:
No return value.
See Also:
cbcapt()
Example:
main()
{
static int flag = 0;
timer();
cbcapt(&flag);
while ( flag == 0 )
printf("Waiting for Ctrl-Break.\n");
printf("Control-Break detected after %ld clock ticks.\n"
,timer());
cbrest();
exit(0);
}
ccenter
Summary:
int ccenter(row,string,color);
int row; /* Row to Center String on */
char *string; /* String to Center on Screen */
int color; /* Color to Print String in */
Created: 12/28/85 Last Updated: 12/28/85
Author: Bob Pritchett Source (C/A): C
Located in: CCENTER.C CENTER.OBJ
Requires: gotoxy() ccputs()
Description:
This routine is functionaly the same as center() only that the
line is displayed in the color specified.
Compiler Specifics:
CCENTER.OBJ was compiled with MSC 3.0, but there are no other
compiler specifics involved.
Return Value:
Nothing is returned and there are no validity checks. Giving a
string longer then 80 characters, or a line number less then zero
or greater then 24 will produce an unknown result on screen,
while it should return cleanly.
See Also:
center() putat() cputat()
Example:
#include <color.h>
char *string;
scanf("%s",string);
ccenter(0,"This line is centered in color.",RED_F);
ccenter(2,"This one is in magenta on black, as opposed to red."
,MAG_F);
ccenter(3,"And yet another line, this time in green.",GRN_F);
ccenter(5,string,WHT_F+BLU_B);
ccls
Summary:
#include <color.h> /* For color definitions only... */
int ccls(color);
int color; /* Color of Screen */
Created: 12/28/85 Last Updated: 12/28/85
Author: Bob Pritchett Source (C/A): A
Located in: CCLS.OBJ
Requires: Nothing.
Description:
This function clears the screen and sets all the attributes to
the given color. The cursor is sent to the home position.
Compiler Specifics:
Has Microsoft's assembly header, otherwise none.
Return Value:
Nothing.
See Also:
cls()
Example:
#include <color.h>
ccls(RED_F+BLU_B); /* Attributes are red on blue. */
ccputs
Summary:
#include <color.h> /* Color definitions only */
int ccputs(string,color);
int string; /* String to Put */
int color; /* Color of String */
Created: 12/29/85 Last Updated: 02/24/86
Author: Bob Pritchett Source (C/A): C
Located in: CCPUTS.OBJ
Requires: putchci()
Description:
This function puts the given string out to the current cursor
position in the specified color, using putchci() to do BIOS
output.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
putchci()
Example:
#include <color.h>
ccputs("This string in red.\n",RED_F);
center
Summary:
int center(row,string);
int row; /* Row to Center String on */
char *string; /* String to Center on Screen */
Created: 09/ /85 Last Updated: 02/24/86
Author: Bob Pritchett Source (C/A): C
Located in: CENTER.C CENTER.OBJ
Requires: gotoxy() prints()
Description:
This routine will simply center string on line row. An eighty
column display is assumed, and the cursor is left at the end of
the string.
Compiler Specifics:
CENTER.OBJ was compiled with MSC 3.0, but there are no other
compiler specifics involved.
Return Value:
Nothing is returned and there are no validity checks. Giving a
string longer then 80 characters, or a line number less then zero
or greater then 24 will produce an unknown result on screen,
while it should return cleanly.
See Also:
centerf() ccenter() putat() cputat()
Example:
#include <stdio.h>
char *string;
scanf("%s",string);
center(0,"This line is centered. Centering has a slight");
center(1,"disadvantage with constant text in that the computation is");
center(2,"done at run-time, as opposed to using putat() with a");
center(3,"precalculated center.");
center(5,string);
centerf
Summary:
int centerf(row,string[,arguments...]);
int row; /* Row to Center String on */
char *string; /* String to Center on Screen */
Created: 04/13/86 Last Updated: 08/17/86
Author: Bob Pritchett Source (C/A): C
Located in: CENTERF.OBJ
Requires: gotoxy() prints()
Description:
This routine performs the exact same function as center() with
the exception that the string may contain formatting controls
which are proccessed according to the same rules as printf()
before the string is centered. Up to 15 formatting arguments may
be used per string.
Compiler Specifics:
None.
Return Value:
Nothing returned, nor are coordinates checked, but be careful to
make sure the formatted string will be less then 80 characters
long.
See Also:
center() ccenter() putat() cputat()
Example:
#include <stdio.h>
char *string;
printf("What is your name? ");
scanf("%s",string);
centerf(4,"The answer is: %04d",243);
centerf(7,"Hello, %s, nice to meet you.",string);
cfield
Summary:
int cfield(chr,clr,tms);
int chr; /* Character to Use in Field */
int clr; /* Attribute to Use for Field */
int tms; /* Length of the Field */
Created: 09/25/86 Last Updated: 09/25/86
Author: Bob Pritchett Source (C/A): A
Located in: CFIELD.OBJ
Requires: Nothing.
Description:
This routine is a special assembly routine to create fields for
the field input routines. Given the fill character, attribute,
and length of the field it will create the field without moving
the cursor. No checking of parameters is done.
Compiler Specifics:
None.
Return Value:
Nothing is returned.
See Also:
finptstr()
Example:
#include <color.h>
cfield('*',WHT_F+BLU_B,10); /* Ten character white on */
/* blue asterisk field. */
chk_date
Summary:
int chk_date(m,d,y);
int m; /* Month of Date to Check */
int d; /* Day of Date to Check */
int y; /* Year of Date to Check */
Created: 12/27/85 Last Updated: 12/27/85
Author: Bob Pritchett Source (C/A): C
Located in: CSRDATE.OBJ
Requires: num_days()
Description:
This routine verifies that the day and month of the given date
are legitimate values. The year is needed in order to check for
leapyears.
Compiler Specifics:
None.
Return Value:
The function evaluates true if the date is valid, false if it is
not.
See Also:
valid_date() num_days() dt_diff()
Example:
if ( chk_date(6,15,1500) ) /* Evaluates True */
function();
chline
Summary:
int chline(x,y,y2,type);
int x; /* Upper Left Row */
int y; /* Upper Left Col */
int y2; /* Lower Right Col */
int type; /* Style of Border */
Created: 03/03/86 Last Updated: 03/03/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: putchci() gotoxy()
Description:
This function will draw a line at x,y to x,y2 using the
character(s) specified in type. Type may be any one of the five
types accepted by box(). Usually this function is used to draw
lines inside boxes, as it will use the proper side characters,
but by using an ASCII character in type an ordinary line of that
character is drawn. The line is drawn in the current color, as
specified by color().
Compiler Specifics:
None.
Return Value:
Returns a one if successful, a negative one if invalid
coordinates are passed.
See Also:
cvline() whline()
Example:
#include <color.h> /* Just for the colors... */
color(RED_F,WHT_B); /* Red on White */
cbox(5,5,20,60,1); /* A box with a single line border */
chline(5,7,60,1); /* Draws a line across the box */
cls
Summary:
int cls();
Created: 12/28/85 Last Updated: 08/20/86
Author: Bob Pritchett Source (C/A): A
Located in: CLS.OBJ
Requires: Nothing.
Description:
This function clears the screen and sends the cursor to the home
position using the video BIOS interrupt.
Compiler Specifics:
Microsoft's assembly header information.
Return Value:
Nothing.
See Also:
ccls() wcls()
Example:
cls();
color
Summary:
#include <color.h> /* For Color Definitions Only */
int color(attr)
int attr; /* Color Attributes */
Created: 03/03/86 Last Updated: 08/06/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This routine sets the colors to be used in all following
operations involving color in the windows package, unless
otherwise specified. In version 1.0 color() required two
arguments, the fore and background attributes. To maintain
compatibility with other <x>color() routines, there is now only
one argument, with the attributes added together.
If color()'s argument is -1, it returns the current value for
color operations. This is useful if you wish to write windowing
functions that restore the current color attributes after opening
their own windows.
Compiler Specifics:
None.
Return Value:
The color is returned.
See Also:
wcolor() mcolor()
Example:
#include <color.h>
color(RED_F+BOLD+BLU_B); /* Bold Red on Blue. */
current_page
Summary:
int current_page();
Created: 02/22/86 Last Updated: 02/24/86
Author: Bob Pritchett Source (C/A): C
Located in: CURSOR.OBJ
Requires: int86()
Description:
This function returns the current active video page.
Compiler Specifics:
Compiled with MSC 3.0. Only specific is use of register
structures of MSC and int86(). Usually needs a change like
sysint() instead of int86(). Check section three of this manual.
Return Value:
Number of current video page is returned, 0-3 or 0-7, depending
on monitor.
See Also:
set_page()
Example:
#include <stdio.h>
printf("The current video display page is: %d\n",current_page());
cursor_off
Summary:
int cursor_off();
Created: 02/22/86 Last Updated: 02/24/86
Author: Bob Pritchett Source (C/A): C
Located in: CURSOR.OBJ
Requires: int86()
Description:
This function will turn the cursor off using the technique used
by graphics modes in order to make it 'invisible.'
Compiler Specifics:
Compiled with MSC 3.0. Only specific is use of register
structures of MSC and int86(). Usually needs a change like
sysint() instead of int86(). Check section three of this manual.
Return Value:
Nothing.
See Also:
cursor_on()
Example:
cursor_off();
cursor_on
Summary:
int cursor_on();
Created: 02/22/86 Last Updated: 05/03/86
Author: Bob Pritchett Source (C/A): C
Located in: CURSOR.OBJ
Requires: int86()
Description:
Doing the opposite of the cursor_off() function this function
restores the cursor and returns the shape (scan lines) to their
default state.
Compiler Specifics:
Compiled with MSC 3.0. Only specific is use of register
structures of MSC and int86(). Usually needs a change like
sysint() instead of int86(). Check section three of this manual.
Return Value:
Nothing.
See Also:
cursor_off()
Example:
cursor_off();
cursor_on();
cursor_read
Summary:
int cursor_read(row,col)
int *row; /* Location to Store Row */
int *col; /* Location to Store Col */
Created: 02/22/86 Last Updated: 02/22/86
Author: Bob Pritchett Source (C/A): C
Located in: CURSOR.OBJ
Requires: int86()
Description:
This funciton places the current cursor positions into row and
col, using the video BIOS interrupt.
Compiler Specifics:
Compiled with MSC 3.0. Only specific is use of register
structures of MSC and int86(). Usually needs a change like
sysint() instead of int86(). Check section three of this manual.
Return Value:
Nothing.
See Also:
gotoxy()
Example:
int x;
int y;
cursor_read(&x,&y);
gotoxy(x+2,y-3); /* Move diagonally down and left. */
cursor_size
Summary:
int cursor_size(start,end);
int start; /* Starting Scan Line */
int end; /* Ending Scan Line */
Created: 02/22/86 Last Updated: 02/24/86
Author: Bob Pritchett Source (C/A): C
Located in: CURSOR.OBJ
Requires: int86()
Description:
This funciton sets the cursor scan lines to start and finish.
Note that specifying a larger start then finish line causes it to
wrap around and form a two part cursor.
Compiler Specifics:
Compiled with MSC 3.0. Only specific is use of register
structures of MSC and int86(). Usually needs a change like
sysint() instead of int86(). Check section three of this manual.
Return Value:
None.
See Also:
cursor_on() cursor_off()
Example:
cursor_size(6,7); /* Sets cursor to two line underline */
/* in color mode. */
cvline
Summary:
int cvline(y,x,x2,type);
int y; /* Upper Left Col */
int x; /* Upper Left Row */
int x2; /* Lower Right Row */
int type; /* Style of Border */
Created: 03/03/86 Last Updated: 03/03/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: putchci() gotoxy()
Description:
This function will draw a line at x,y to x2,y using the
character(s) specified in type. Type may be any one of the five
types accepted by box(). Usually this function is used to draw
lines inside boxes, as it will use the proper top and bottom
characters, but by using an ASCII character in type an ordinary
line of that character is drawn. The line is drawn in the
current color, as specified by color().
Compiler Specifics:
None.
Return Value:
Returns a one if successful, a negative one if invalid
coordinates are passed.
See Also:
chline() wvline()
Example:
#include <color.h> /* Just for the colors... */
color(RED_F,WHT_B); /* Red on White */
cbox(5,5,20,60,1); /* A box with a single line border */
cvline(7,5,20,1); /* Draws a line down the box */
date_sn
Summary:
unsigned int date_sn(m,d,y);
int m; /* Month */
int d; /* Day */
int y; /* Year */
Created: 09/01/86 Last Updated: 09/01/86
Author: George Roukas Source (C/A): C
Located in: CSRDATE.OBJ
Requires: valid_date() day_of_year() isleap()
Description:
This function turns the given date into a single integer serial
number which it returns. This serial number is used by various
other date routines and can also be used for date arithmetic.
The serial number may not exceed 54788, the number of days
between January 1, 1900, and December 31, 2049.
Note that the year may be in either four or two digit form.
Compiler Specifics:
None.
Return Value:
Returns an unsigned integer serial number.
See Also:
dt_diff() valid_date() sn_date()
Example:
int m, d, y;
printf("\nEnter your birthdate: (MM/DD/YY) ");
scanf("%d/%d/%d",m,d,y);
printf("\nYou special serial number is %d.\n",date_sn(m,d,y));
day_of_year
Summary:
int date_sn(m,d,y);
int m; /* Month */
int d; /* Day */
int y; /* Year */
Created: 09/01/86 Last Updated: 09/01/86
Author: George Roukas Source (C/A): C
Located in: CSRDATE.OBJ
Requires: isleap()
Description:
This function is similar to the day_of_year() function in K&R, pp
103-104, and returns the number of elapsed days in the given
year.
Compiler Specifics:
None.
Return Value:
Elapsed days since the beginning of the year. 1/1 = 1, 1/2 = 2,
etc.
See Also:
month_day()
Example:
int m, d, y;
printf("\nEnter your birthdate: (MM/DD/YY) ");
scanf("%d/%d/%d",m,d,y);
printf("\nYou were born on the %d day of the year.\n"
,day_of_year(m,d,y));
dirwin
Summary:
int dirwin(path,name);
char *path; /* Path, With Drive */
char *name; /* Template for File Name */
Created: 04/20/86 Last Updated: 04/22/86
Author: Bob Pritchett Source (C/A): C
Located in: DIRWIN.OBJ
Requires: ffirst() fnext()
Description:
This routine opens a window in the current colors in which the
specified directory is displayed in four columns of nine file
names. When a directory exceeds thirty-six file names a key
press clears the window and displays the next thirty-six, and so
on until the last screen is displayed, after which the window is
closed.
The pathname should include the drive letter and subdirectory
path. If the root is being used at least the \ should be in
path. The title used is "[ Dir: %s\\%s ]",path,name. An
appropriate path and template might be: "A:\\","*.*".
The file names are displayed once in the order they are found on
the disk. (The same order with the DIR command at the DOS
prompt.) The filenames are left justified in their columns with
a dot separater between the name and extension.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
Example:
dirwin("C:\\C","*.C");
dma
Summary:
int dma(x);
int x; /* Value of DMA Flag */
Created: 05/24/86 Last Updated: 05/24/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This routine sets the direct memory access flag on or off. The
flag defaults to 1, on.
Compiler Specifics:
None.
Return Value:
Returns -1 if a value other than 1 or 0 is passed.
See Also:
retrace()
Example:
dma(0); /* Turn off Direct Memory Access */
dt_diff
Summary:
int dt_diff(m,d,y,mn,dy,yr);
int m; /* Month of First Date */
int d; /* Day of First Date */
int y; /* Year of First Date */
int mn; /* Month of Second Date */
int dy; /* Day of Second Date */
int yr; /* Year of Second Date */
Created: 12/27/85 Last Updated: 08/17/86
Author: Bob Pritchett Source (C/A): C
Located in: CSRDATE.OBJ
Requires: Nothing.
Description:
This function will return the number of days difference between
the two dates passed as parameters.
Compiler Specifics:
None.
Return Value:
Returns the number of days difference.
See Also:
date_sn() sn_date() chk_date() num_days()
Example:
int m;
int d;
int y;
printf("I am %d days old as of August 17th, 1986.\n"
,dt_diff(6,15,1971,8,17,1986));
/* The above returns 5541. */
get_date(&d,&m,&y);
printf("Ronald Reagan was born %d days ago.\n"
,dt_diff(2,6,1911,m,d,y));
printf("C Spot Run Version 1.0 was released %d days ago.\n"
,dt_diff(5,5,1986,m,d,y));
fchar
Summary:
int fchar(chr);
int chr; /* Character to Use in Fields */
Created: 09/25/86 Last Updated: 09/25/86
Author: Bob Pritchett Source (C/A): C
Located in: FINPUT.OBJ
Requires: Nothing.
Description:
This function sets the character to be used for the background of
field input. The default is an ASCII space, and when chr is
given as -1, at any time, the function will return the current
value of the background character. Otherwise the value of chr
will be returned.
Compiler Specifics:
None.
Return Value:
Returns the argument, or in the case of the argument being -1,
the current value of the background character.
See Also:
wfchar() fcolor() ffill() finptint() finptstr()
Example:
fchar('*'); /* Set background to *'s. */
printf("The current background character is: %c.\n",fchar(-1));
fcolor
Summary:
#include <color.h> /* For Color Defintions Only */
int fcolor(clr);
int clr; /* Color to Use in Fields */
Created: 09/25/86 Last Updated: 09/25/86
Author: Bob Pritchett Source (C/A): C
Located in: FINPUT.OBJ
Requires: Nothing.
Description:
This function allows specification of the color to be used in
field input routines. If the argument clr is equal to -1 the
current color is returned, and not changed. The default is white
on black.
Compiler Specifics:
None.
Return Value:
Returns the argument, or in the case of the argument being -1,
the current value of the field color.
See Also:
wfcolor() fchar() ffill() finptint() finptstr()
Example:
#include <color.h>
fcolor(BLK_F+WHT_B); /* Reverse video attribute. */
ffill
Summary:
int ffill(rw,cl,mx);
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
Created: 12/05/86 Last Updated: 12/05/86
Author: Bob Pritchett Source (C/A): C
Located in: FINPUT.OBJ
Requires: gotoxy() cfield()
Description:
The actual input fields used by the input routines are created
when the input is performed, and remain on the screen to allow
the program to bring the user back to change the field's
contents. This arrangement means, though, that a full screen of
field input will not display all the actual fields until all the
input has been performed. This function takes the three
arguments common to any field input function call in order to
'draw' the fields before input is performed. The current field
color and character attributes are used.
Compiler Specifics:
None.
Return Value:
Nothing is returned.
See Also:
wffill() fchar() fcolor() finptint() finptstr()
Example:
ffill(10,20,10); /* At 10,20 a 10 character field. */
putat(5,10,"Num: "); /* A prompt for the next field. */
ffill(5,15,6); /* At 5,15 a 6 character field. */
gotoxy(5,15); /* Not needed, as ffill() leaves */
/* the cursor at the coordinates. */
ccputs("192",fcolor(-1)); /* Put a default value on the */
/* screen with the field color. */
ffirst
Summary:
#include <csrdos.h> /* Contains struct DIRS, for buf */
int ffirst(dir,buf,template,attr);
char *dir; /* Subdir to Use */
char *buf; /* Location to Store Data */
char *template; /* FileName/Template to Search for */
int attr; /* Attribute to Include in Search */
Created: 04/04/86 Last Updated: 04/15/86
Author: Bob Pritchett Source (C/A): C
Located in: DIRSRCH.OBJ
Requires: intdos()
Description:
Using DOS 2.0 function 0x4e (2.00 and above only) this function
begins the search for a file in the specified directory using
either a file name or template with wildcard characters ( ? * )
as the file to search for. The path must be a standard DOS path
name (without file name), using two backslashes instead of one.
If the path to search is the root, use the path string of "".
The attribute specified in attr is the attribute to use in the
search. If none is specified, then only files are reported. If
the volume attribute is used, the volume label is returned. If
the sub-directory attribute is specified, all files AND sub-
directories are returned. The same applies to the hidden and
and system attributes, but the archive and read-only attributes
can not be used in searches.
After a file is found it's data is placed in buf (consult
CSRDOS.H for the DIRS structure). The entry type may be
determined by & ing the returned attribute and the attribute you
wish to test for, as in if ( buf.attr & SUBDIR ) would be true
if the entry was a subdirectory.
Compiler Specifics:
None.
Return Value:
Returns the value of the AX register, 2 for file not found, and
18 for no more files to be found.
See Also:
fnext()
ffirst
Example:
#include <csrdos.h>
struct DIRS buf;
ffirst("",&buf,"*.SYS",0); /* Find first .SYS file in root. */
fnext
Summary:
#include <csrdos.h> /* Contains struct DIRS, for buf */
int fnext(dir,buf,template,attr);
char *dir; /* Subdir to Use */
char *buf; /* Location to Store Data */
char *template; /* FileName/Template to Search for */
int attr; /* Attribute to Include in Search */
Created: 04/04/86 Last Updated: 04/15/86
Author: Bob Pritchett Source (C/A): C
Located in: DIRSRCH.OBJ
Requires: intdos()
Description:
Using DOS 2.0 function 0x4f (2.00 and above only) this function
continues the search begun with ffirst(). This function is
dependant upon information left in the first 21 bytes of the
buffer used in ffirst, so use the same buffer, or begin a new
sequence with ffirst().
Compiler Specifics:
None.
Return Value:
Returns the value of the AX register, 18 for no more files to be
found, or nothing.
See Also:
ffirst().
Example:
#include <csrdos.h>
int x;
struct DIRS buf;
ffirst("",&buf,"*.SYS",0); /* Find first .SYS file in root. */
while ( x != 18 )
{
printf("%s %ld\n",buf.name,buf.size); /* Print name & size. */
x = fnext("",&buf,"*.SYS",0); /* Find next entry. */
}
finptint
Summary:
int finptint(rw,cl,mx,x);
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
int *x; /* Where to Put Result */
Created: 09/25/86 Last Updated: 09/25/86
Author: Bob Pritchett Source (C/A): C
Located in: FINPUT.OBJ
Requires: gotoxy() cfield()
Description:
This function will draw the field as specified by the first three
arguments, and place the cursor at the first character of this
field. (See ffill() about drawing the field.) It will then wait
for the user to input an integer number with no more than mx
characters. The funtion will not allow the user to move on
without entering an integer.
Compiler Specifics:
None.
Return Value:
The integer inputted is returned.
See Also:
inptint() finptintd() wfinptint() ffill() finptstr()
Example:
int x;
putat(5,10,"Num: "); /* A prompt for the next field. */
finptint(5,15,6,&x); /* At 5,15 a 6 character input. */
printf("\n\n%d was the input.\n",x);
finptintd
Summary:
int finptintd(rw,cl,mx,x,d);
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
int *x; /* Where to Put Result */
int d; /* Default Integer */
Created: 09/25/86 Last Updated: 09/25/86
Author: Bob Pritchett Source (C/A): C
Located in: FINPUT.OBJ
Requires: gotoxy() cfield()
Description:
This function will behave just as does finptint() with the
exception that a carriage return as the first inputted character
will cause the default variable to be returned. Any other
character as the first input will cause the default to be erased
to be replaced by the user input.
Compiler Specifics:
None.
Return Value:
The integer inputted is returned, or, in the case of a carriage
return, the default.
See Also:
inptintd() finptint() wfinptintd() ffill() finptstr()
Example:
int x;
putat(5,10,"Num: "); /* A prompt for the next field. */
finptintd(5,15,4,&x,37); /* At 5,15 a 4 character input. */
if ( x == 37 )
printf("\n\nThe default, 37, was returned.\n");
else
printf("\n\n%d was the input.\n",x);
finptintr
Summary:
int finptintr(rw,cl,mx,x,lw,hg);
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
int *x; /* Where to Put Result */
int lw; /* Minimum Acceptable Value */
int hg; /* Maximum Acceptable Value */
Created: 09/25/86 Last Updated: 09/25/86
Author: Bob Pritchett Source (C/A): C
Located in: FINPUT.OBJ
Requires: finptint()
Description:
This function waits for a user inputted integer in the displayed
field. A beep will sound and a new integer waited for if there
is no input or the inputted integer is not within the specified
range.
Compiler Specifics:
None.
Return Value:
The inputted integer, within the range, is returned.
See Also:
inptintr() finptint() wfinptintd() ffill() finptstr()
finptintrd()
Example:
int x;
putat(5,10,"Num: "); /* A prompt for the next field. */
finptintr(5,15,4,&x,3,10); /* At 5,15 a 4 character input */
/* greater than 2 and less than */
/* ten. */
finptintrd
Summary:
int finptintrd(rw,cl,mx,x,lw,hg,d);
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
int *x; /* Where to Put Result */
int lw; /* Minimum Acceptable Value */
int hg; /* Maximum Acceptable Value */
int d; /* Default Value */
Created: 09/25/86 Last Updated: 09/25/86
Author: Bob Pritchett Source (C/A): C
Located in: FINPUT.OBJ
Requires: finptintd()
Description:
This function behaves as do finptintr() and finptintd(),
combined. However no check is made to see that the default value
is within the given range. If it is not, it will not be
returnable.
Compiler Specifics:
None.
Return Value:
The inputted integer, within the range, is returned, or, in the
case of a carriage return as the first inputted character, the
default value.
See Also:
inptintr() finptint() wfinptintd() ffill() finptstr()
finptintr()
Example:
int x;
putat(5,10,"Num: "); /* A prompt for the next field. */
finptintrd(5,15,4,&x,3,10,5);/* At 5,15 a 4 character input */
/* greater than 2 and less than */
/* ten, or 5. */
finptstr
Summary:
int finptstr(rw,cl,mx,str);
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
char *str; /* Where to Place Input */
Created: 09/25/86 Last Updated: 09/25/86
Author: Bob Pritchett Source (C/A): C
Located in: FINPUT.OBJ
Requires: gotoxy() cfield()
Description:
This function displays the field and waits for a string to be
inputted by the user. In the case that no input is made a beep
is sounded and the function continues to wait until a string is
inputted. When it is, it is placed in the variable specified,
str.
Compiler Specifics:
None.
Return Value:
A pointer to a duplicate of the inputted string is returned, via
strdup().
See Also:
inptintr() finptint() wfinptintd() ffill() finptstr()
finptstrd()
Example:
char temp[80];
finptstr(10,10,25,temp);
finptstrd
Summary:
int finptstrd(rw,cl,mx,str,def);
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
char *str; /* Where to Place Input */
char *def; /* Default String */
Created: 09/25/86 Last Updated: 09/25/86
Author: Bob Pritchett Source (C/A): C
Located in: FINPUT.OBJ
Requires: gotoxy() cfield()
Description:
This function behaves as does finptstr() with the exception that
the specified default string is displayed and will be returned as
the input in the case of a carriage return as the first character
entered.
Compiler Specifics:
None.
Return Value:
A pointer to a duplicate of the inputted string, or the default,
is returned, via strdup().
See Also:
inptintr() finptint() wfinptintd() ffill() finptstr()
finptstre()
Example:
char temp[80];
finptstrd(10,10,25,temp,"C Spot Run");
finptstre
Summary:
int finptstre(rw,cl,mx,str);
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
char *str; /* Where to Place Input */
Created: 10/18/86 Last Updated: 10/18/86
Author: Bob Pritchett Source (C/A): C
Located in: FINPUT.OBJ
Requires: finptstred()
Description:
This function calls finptstred() with a NULL string for a
default and will not return until input has been made.
Compiler Specifics:
None.
Return Value:
Nothing is returned.
See Also:
inptstr() finptint() wfinptintd() ffill() finptstr()
finptstred() finptstr()
Example:
char temp[80];
finptstre(10,10,25,temp);
printf("temp contains: >%s<\n");
finptstred
Summary:
int finptstred(rw,cl,mx,str,def);
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
char *str; /* Where to Place Input */
char *def; /* Default String */
Created: 10/18/86 Last Updated: 10/18/86
Author: Bob Pritchett Source (C/A): C
Located in: FINPUT.OBJ
Requires: gotoxy() cfield()
Description:
This powerful function displays the field specified and places
the default string within it, and the cursor at the first
character of this string. The default string may be returned
with a carriage return as the first character, it may be editted
with the left and right arrow keys and ins and del, the field may
be erased with the Alt-X combination, and the default input can
be restored with the Alt-D combination. Editting is performed
with the ins and del keys in combination with movement by the
left and right arrow keys. The insert key will toggle insert
'mode' on and off, although the cursor will not reflect the mode
change. When in insert mode all characters to the right of the
cursor will move right (and possibly scroll out of the field)
when characters are inputted. The del key will erase the
character the cursor rests on and move everything to the right of
the cursor left one space. In order to allow for design of full
input screens the function will return with the input in the
appropriate location and the value of the key as the return value
if one of several extended function keys is entered. These
special keys are any use of a function key or keys, other than
left and right arrows, on the numeric keypad. (Home, up, down,
end, PgUp, PgDn.) (NOTE: Steps were taken to make this function
as flexible as possible. However, in most cases requiring
complicated input the peculiarities of this and related functions
will damage their usefullness. If you need to make use of this
type of function in an 'error proof' application it is
recommended that you contact the author about getting a special
routine or the source code to this one.)
Compiler Specifics:
None.
finptstred
Return Value:
A one is returned unless input was terminated by a special key,
in which case its value will be returned. (Special keys return a
null followed by an integer. The integer is returned here.)
See Also:
inptstr() finptint() wfinptintd() ffill() finptstr()
finptstred()
Example:
char temp[80];
int x;
x = finptstred(10,10,25,temp,"C Spot Run");
if ( x != 1 ) /* Special Value */
proccess(x); /* Proccess Key */
finptyn
Summary:
int finptyn(rw,cl);
int rw; /* Row of Field */
int cl; /* Column of Field */
Created: 09/25/86 Last Updated: 09/25/86
Author: Bob Pritchett Source (C/A): C
Located in: FINPUT.OBJ
Requires: gotoxy() cfield()
Description:
This function displays a three character field at the given
coordinates and waits for either a 'Y' or an 'N' (upper or lower
case) to be inputted. Any other character will cause the
function to sound a beep and continue to wait. When a valid
character is inputted the full word will be displayed in the
field and either a one or zero returned, for 'Y' or 'N',
respectively.
Compiler Specifics:
None.
Return Value:
A one or a zero for a 'Y' or an 'N'.
See Also:
inptyn() finptint() wfinptintd() ffill() finptstr() finptynd()
Example:
char temp[80];
finptyn(10,10);
finptynd
Summary:
int finptynd(rw,cl,def);
int rw; /* Row of Field */
int cl; /* Column of Field */
int def; /* Default Input */
Created: 09/25/86 Last Updated: 09/25/86
Author: Bob Pritchett Source (C/A): C
Located in: FINPUT.OBJ
Requires: gotoxy() cfield()
Description:
This function behaves exactly as finptyn() with the exception
that the default input is displayed and will be returned if a
carriage return is entered instead of a 'Y' or 'N'. The default
value needs to be in the format of the return value, a one or
zero.
Compiler Specifics:
None.
Return Value:
A one or a zero for a 'Y' or an 'N', or whatever the default was.
See Also:
inptynd() finptint() wfinptintd() ffill() finptstr() finptyn()
Example:
char temp[80];
finptynd(10,10,0); /* Default to no. */
fixcolor
Summary:
int fixcolor(atrib);
int *attr; /* Attribute to Check/Modify */
Created: 12/12/86 Last Updated: 12/13/86
Author: Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function will, when a monochrome card, or the CGA's black
and white mode, is currently in use, modify the attribute in
order to make it compatible with monochrome attribute set. This
routine is used internally by the windowing functions.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
color() wcolor()
Example:
#include <color.h>
int x;
int y;
x = WHT_F+BLU_B;
y = RED_F+WHT_B;
fixcolor(&x); /* Modify the attribute if neccessary. * /
fixcolor(&y);
/* On a monochrome card x is now equivalent to WHT_F+BLK_B, */
/* and y to BLK_F+WHT_B. */
gback
Summary:
int gback(clr);
int clr; /* Color for Background */
Created: 10/31/86 Last Updated: 10/31/86
Author: Bob Pritchett Source (C/A): A
Located in: GBACK.OBJ
Requires: Nothing.
Description:
This routine initializes the graphics screen to the specified
color, one of the palette colors in the description of gpal().
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
ginit() gline() gdot() gpal()
Example:
ginit();
gpal(0);
gback(1); /* Background to Green */
gdot(10,10,2); /* Red Dot at 10,10 */
gbox
Summary:
int gbox(x,y,x2,y2,clr);
int x; /* Upper Left Row */
int y; /* Upper Left Column */
int x2; /* Lower Right Row */
int y2; /* Lower Right Column */
int clr; /* Color for Box */
Created: 11/01/86 Last Updated: 11/01/86
Author: Bob Pritchett Source (C/A): C
Located in: GBOX.OBJ
Requires: gline()
Description:
This function draws a box with the coordinates given in the given
color. See gpal() and ginit() for information on valid values.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
ginit() gline() gfbox() gpal()
Example:
ginit();
gpal(0);
gback(2); /* Background to Red */
gbox(10,10,20,20,1); /* Green Box at 10,10 */
gcircle
Summary:
int gcircle(x,y,r,clr);
int x; /* Row of Center */
int y; /* Column of Center */
int r; /* Radius of Circle */
int clr; /* Color for Box */
Created: 10/31/86 Last Updated: 10/31/86
Author: Source (C/A): C
Located in: GCIRCLE.OBJ
Requires: gdot()
Description:
This routine draws a circle at the given row and column in the
specified color with the given radius. This routine assumes an
aspect ratio of 1, and consequently will generate slightly
eliptical circles on an IBM PC.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
ginit() gline() gdot() gpal()
Example:
ginit();
gpal(0);
gback(2); /* Background to Red */
gcircle(100,150,10,1); /* Green Circle with radius of 10. */
gdot
Summary:
int gdot(x,y,clr);
int x; /* Row */
int y; /* Column */
int clr; /* Color */
Created: 10/31/86 Last Updated: 10/31/86
Author: Bob Pritchett Source (C/A): A
Located in: GDOT.OBJ
Requires: Nothing.
Description:
This function puts a graphic dot at the row and column specified.
The color may be 0-3 in medium resulution, or 0-1 in high. See
the descriptions of gpal() and ginit() for a list of colors and
maximum coordinate values.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
ginit() gline() gback() gpal()
Example:
ginit();
gpal(0);
gdot(10,10,2);
get_date
Summary:
int get_date(dy,mn,yr);
int *dy; /* Location of Day */
int *mn; /* Location of Month */
int *yr; /* Location of Year */
Created: 03/31/86 Last Updated: 03/31/86
Author: Bob Pritchett Source (C/A): C
Located in: GET_DATE.OBJ
Requires: intdos()
Description:
This routine obtains the current date by using the DOS interrupt
0x2a, and places it into the variables specified. The day starts
with numbering with 1, and continue to a maximum of 31, the month
is numbered from 1 to 12, and the year is from 1980 to 2099.
Compiler Specifics:
Compiled with MSC 3.0, uses the dosint() function and register
unions specified in DOS.H.
Return Value:
Nothing.
See Also:
get_dow() set_date() get_time()
Example:
int d;
int m;
int y;
get_date(&d,&m,&y);
printf("Today is %d/%d/%d.\n",m,d,y);
get_dow
Summary:
int get_dow();
Created: 03/31/86 Last Updated: 03/31/86
Author: Bob Pritchett Source (C/A): C
Located in: GET_DOW.OBJ
Requires: intdos()
Description:
This routine returns the day of the week, 0 for sunday, 1 for
monday, etc. It is obtained with a DOS interrupt.
Compiler Specifics:
Compiled with MSC 3.0, uses the dosint() function and register
unions specified in DOS.H.
Return Value:
Nothing.
See Also:
get_date() get_time()
Example:
printf("Today is the %d day of the week.\n",get_dow());
get_drive
Summary:
int get_drive();
Created: 04/04/86 Last Updated: 04/04/86
Author: Bob Pritchett Source (C/A): A
Located in: GETDRIVE.OBJ
Requires: Nothing.
Description:
This function returns a single integer representing the current
logical drive. The drives are number from 0, as in 0 = A, 1 = B,
2 = C, etc. Remember that even with only one floppy, DOS will
still have an A and B drive, with the single floppy acting as
both.
Compiler Specifics:
None.
Return Value:
The current drive.
See Also:
set_drive() num_drives()
Example:
printf("Current Drive is: %c:\n",'A'+get_drive());
get_mode
Summary:
int get_mode();
Created: 04/16/86 Last Updated: 08/06/86
Author: Bob Pritchett Source (C/A): A
Located in: GETMODE.OBJ
Requires: Nothing.
Description:
This function returns the current video mode.
Compiler Specifics:
None.
Return Value:
The current video mode.
See Also:
set_mode()
Example:
#include <stdio.h>
printf("Current video mode is: %d\n",get_mode());
getpw
Summary:
int getpw(pass);
char *pass; /* The Password to Check Against */
Created: 04/13/86 Last Updated: 08/08/86
Author: Bob Pritchett Source (C/A): C
Located in: GETPW.OBJ
Requires: Windowing routines and getch().
Description:
This function opens a small blue and white window in the center
of the screen and inputs a password up to eighteen characters
long. As each character is inputed an asterisk is echoed.
Backspace editing is permitted. If the entered password is equal
to the specified password (case ignored) the funtion returns a
one, otherwise it returns a 0 on failure.
Compiler Specifics:
Uses MSC's getch().
Return Value:
1 if the correct password is entered, 0 if not.
See Also:
Example:
if ( getpw("pass") == 0 )
printf("** Access Denied **\n");
get_time
Summary:
int get_time(hr,mn,sc,hn);
int *hr; /* Location of Hour */
int *mn; /* Location of Minutes */
int *sc; /* Location of Seconds */
int *hn; /* Location of Hundredths */
Created: 03/31/86 Last Updated: 03/31/86
Author: Bob Pritchett Source (C/A): C
Located in: GET_TIME.OBJ
Requires: intdos()
Description:
Using DOS interrupt 0x2c this routine obtains the current time,
to the hundredths, and places it in the variables specified. The
time is given in 24 hour format, and everything starts counting
at 0, 0 to 23 hours, 0 to 59 seconds etc.
Compiler Specifics:
Compiled with MSC 3.0, uses the dosint() function and register
unions specified in DOS.H.
Return Value:
Nothing.
See Also:
get_dow() get_date() set_time()
Example:
int h;
int m;
int s;
int hn;
get_time(&h,&m,&s,&hn);
printf("The time is %d:%d:%d.%d.\n",h,m,s,hn);
get_timer
Summary:
long get_timer();
Created: 01/03/87 Last Updated: 01/03/87
Author: Dave Perras Source (C/A): C
Located in: TIMERS.C TIMERS.OBJ
Requires: int86()
Description:
This function is used by the other timer routines in order to get
the value of the real time clock. All DOS and compiler specifics
concerning the timer routines are contained in this routine.
Compiler Specifics:
This function uses the int86() function and may need to be
modified for some compilers.
Return Value:
A long value is returned holding the number of clock ticks from
the real time clock counter.
See Also:
start_tmr() stop_tmr() read_tmr() reset_tmr() zero_tmr() timer()
init_tmr()
Example:
long ltime;
ltime = get_timer();
gfbox
Summary:
int gfbox(x,y,x2,y2,clr);
int x; /* Upper Left Row */
int y; /* Upper Left Column */
int x2; /* Lower Right Row */
int y2; /* Lower Right Column */
int clr; /* Color for Box */
Created: 11/01/86 Last Updated: 11/01/86
Author: Bob Pritchett Source (C/A): C
Located in: GFBOX.OBJ
Requires: gline()
Description:
This function is identical to gbox() with the exception that the
box created is filled in with the specified color.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
ginit() gline() gpal() gbox()
Example:
ginit();
gpal(0);
gback(2); /* Background to Red */
gfbox(10,10,20,20,1); /* Solid Green Box at 10,10 */
ginit
Summary:
int ginit();
Created: 10/31/86 Last Updated: 10/31/86
Author: Bob Pritchett Source (C/A): C
Located in: GINIT.OBJ
Requires: Nothing.
Description:
This function sets up the screen on a CGA for medium resolution
graphics. It is the exact equivalent of set_mode(4). To set up
for high resolution graphics, use the command set_mode(6) instead
of ginit().
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
set_mode() gback() gdot() gpal()
Example:
ginit(); /* Medium Resolution Screen */
gpal(0);
gback(2); /* Background to Red */
gcircle(100,150,10,1); /* Green Circle with radius of 10. */
gline
Summary:
int gline(x,y,x2,y2,clr);
int x; /* Starting Row */
int y; /* Starting Column */
int x2; /* Ending Row */
int y2; /* Ending Column */
int clr; /* Color of Line */
Created: / / Last Updated: / /
Author: Dan Rollins Source (C/A): C
Located in: GLINE.OBJ
Requires: gdot()
Description:
This routine, found in the Febuary, 1986, Dr. Dobb's Journal,
plots a line from the first to the second set of coordinates.
The first set of coordinates needn't be lower than the second.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
gcircle() gback() gdot() gpal()
Example:
ginit(); /* Medium Resolution Screen */
gpal(0);
gback(2); /* Background to Red */
gline(10,10,50,50,1); /* A Diagonal Green Line */
gotoxy
Summary:
int gotoxy(row,col);
int row; /* Screen Row */
int col; /* Screen Column */
Created: 00/00/00 Last Updated: 08/20/86
Author: Source (C/A): A
Located in: GOTOXY.OBJ
Requires: Nothing
Description:
The gotoxy function will set the cursor to the screen coordinates
specified in row and col, regardless of windows or other high-
level screen manipulation.
Service two of the bios video interrupt 0x10 is used.
Compiler Specifics:
Assembled with calling sequence for MSC 3.0 and Lattice. Other
compilers not yet tested. Standard Microsoft OBJ format.
Return Value:
This routine returns nothing, and does not check coordinate
validity.
See Also:
wgotoxy()
Example:
#include <stdio.h>
int row;
int col;
row = 10;
col = 20;
gotoxy(row,col);
printf("I am now at Column 20 on Row 10.\n");
gpal
Summary:
int gpal(palette);
int palette; /* Color Palette to Use */
Created: 10/31/86 Last Updated: 10/31/86
Author: Bob Pritchett Source (C/A): A
Located in: GPAL.OBJ
Requires: Nothing.
Description:
This routine sets the current color palette for use in medium
resolution graphics. (In high resolution graphics the only
choices are on one palette, 0 for black, 1 for white.)
Palette 0: Palette 1:
(0) Background Color (0) Background Color
(1) Green (1) Cyan
(2) Red (2) Magenta
(3) Brown (3) White
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
ginit() gback() gdot()
Example:
ginit(); /* Medium Resolution Screen */
gpal(0);
gback(2); /* Background to Red */
gline(10,10,50,50,3); /* A Diagonal Brown Line */
init_tmr
Summary:
void init_tmr();
Created: 01/03/87 Last Updated: 01/03/87
Author: Dave Perras Source (C/A): C
Located in: TIMERS.C TIMERS.OBJ
Requires: get_timer()
Description:
This function must be called before any of the other timer
functions are called. It tests the real time clock to ensure
that it is operating, clears the ten timers to zero and sets an
internal flag to show that the timers have been initialized.
Compiler Specifics:
None.
Return Value:
This function returns the elapsed time (in tenths of seconds) for
16000 iterations of an empty "for" loop. If the real time clock
is diagnosed as not working, and error value of zero is returned.
See Also:
start_tmr() stop_tmr() read_tmr() reset_tmr() zero_tmr()
get_timer()
Example:
#include <stdio.h>
if ( ! init_tmr() )
fprintf(stderr,"Real Time Clock Error\n");
inptint
Summary:
int inptint(prompt);
char *prompt; /* Prompt for Input */
Created: 08/16/86 Last Updated: 08/16/86
Author: Bob Pritchett Source (C/A): C
Located in: INPUT.OBJ
Requires: Nothing.
Description:
This function displays the prompt given at the current cursor
location using stdout and then inputs an integer. After a
carriage return (with mandatory input of an integer) the value
entered is returned.
Compiler Specifics:
None.
Return Value:
The integer inputted.
See Also:
inptintd() inptintr() inptintrd()
Example:
printf("inptint() returns: %d.\n",inptint("Enter Integer:"));
/* The above function prompts "Enter Integer: " and then */
/* executes the printf statement. */
inptintd
Summary:
int inptintd(prompt,def);
char *prompt; /* Prompt for Input */
int def; /* Default Integer */
Created: 08/16/86 Last Updated: 08/16/86
Author: Bob Pritchett Source (C/A): C
Located in: INPUT.OBJ
Requires: Nothing.
Description:
This function displays the prompt given followed by the default
integer. If a carriage return is entered as the first character
the default integer will be returned. If any other valid
character is entered the default will be erased and the user may
enter an integer value.
Compiler Specifics:
None.
Return Value:
The integer inputted, or the default.
See Also:
inptint() inptintr() inptintrd()
Example:
printf("inptintd() returns: %d.\n",inptintd("Enter Integer:",9));
/* The above function prompts "Enter Integer: " and then */
/* executes the printf statement. */
inptintr
Summary:
int inptintr(prompt,low,high);
char *prompt; /* Prompt for Input */
int low; /* Lowest Acceptable Input */
int high; /* Highest Acceptable Input */
Created: 08/16/86 Last Updated: 08/16/86
Author: Bob Pritchett Source (C/A): C
Located in: INPUT.OBJ
Requires: Nothing.
Description:
After displaying the prompt specified this function will input
and integer in the same manner as inptint(), only checking to
make sure that the value inputted is within the range given. If
it is not equal to or within this range the function will prompt
for another integer until a valid one is entered.
Compiler Specifics:
None.
Return Value:
The integer inputted, within the specified range.
See Also:
inptint() inptintd() inptintrd()
Example:
printf("inptintr() returns: %d.\n",inptintr("Enter Integer:"
,5,62));
/* The above function prompts "Enter Integer: " and then */
/* executes the printf statement. The returned value */
/* will be greater than 4 and less than 63. */
inptintrd
Summary:
int inptintrd(prompt,low,high,def);
char *prompt; /* Prompt for Input */
int low; /* Lowest Acceptable Input */
int high; /* Highest Acceptable Input */
int def; /* Default Value */
Created: 08/16/86 Last Updated: 08/16/86
Author: Bob Pritchett Source (C/A): C
Located in: INPUT.OBJ
Requires: Nothing.
Description:
This function displays the default integer value after the prompt
and then returns either the default integer or a user inputted
value within the specified range. The input follows the same
rules as inptintd() and inptintr().
Compiler Specifics:
None.
Return Value:
The integer inputted, or the default, within the specified range.
See Also:
inptint() inptintd() inptintr()
Example:
printf("inptintrd() returns: %d.\n",inptintrd("Enter Integer:"
,8,50,30));
/* The above function prompts "Enter Integer: 30" and */
/* then executes the printf statement. The returned */
/* value will be greater than 7 and less than 51. */
inptstr
Summary:
char *inptstr(prompt);
char *prompt; /* Prompt for Input */
Created: 08/25/86 Last Updated: 08/25/86
Author: Bob Pritchett Source (C/A): C
Located in: INPUT.OBJ
Requires: Nothing.
Description:
After displaying the given prompt this function waits for an
input string. Nothing longer than 80 characters will be handled
correctly, and the routine will beep at a carriage return in the
first column, making some input mandatory. For functions with
more control over input parameters, see inptstrd() and finptstr()
and related routines.
Compiler Specifics:
None.
Return Value:
The character string inputted.
See Also:
inptstrd() finptstr() finptstrd() finptstre() finptstred()
Example:
printf("Hello there, %s.\n",inptstr("Your name?"));
inptstrd
Summary:
char *inptstrd(prompt,def);
char *prompt; /* Prompt for Input */
char *def; /* Default String */
Created: 08/25/86 Last Updated: 08/25/86
Author: Bob Pritchett Source (C/A): C
Located in: INPUT.OBJ
Requires: Nothing.
Description:
This function acts in the same manner as inptstr() with the
exception that a default string may be specified, and at the
choice of the user this string may be returned instead of a user
entered string. When the function is called the default string
is displayed immediately following the prompt, and the cursor is
placed at the first character of the string. If a carriage
return is entered as the first inputted character, the default
string is returned. Any other key causes the default string to
be erased and a user entered string may be inputted.
Compiler Specifics:
None.
Return Value:
The character string inputted, or the default string.
See Also:
inptstr() finptstr() finptstrd() finptstre() finptstred()
Example:
printf("Hello there, %s.\n",inptstrd("Your name?","Richard"));
inptyn
Summary:
char *inptyn(prompt);
char *prompt; /* Prompt for Input */
Created: 08/16/86 Last Updated: 08/16/86
Author: Bob Pritchett Source (C/A): C
Located in: INPUT.OBJ
Requires: Nothing.
Description:
This function displays the given prompt and then waits for either
a Y or an N in reply. A single character is all that is
inputted, and a Y or N must be entered. If a Y is entered a one
is returned, if an N is entered a zero is returned.
Compiler Specifics:
None.
Return Value:
A one or zero, dependent on the inputted character.
See Also:
inptynd() finptyn() finptynd();
Example:
if ( inptyn("Do you program microcomputers?") )
printf("Oh, you do.");
/* Prompts 'Do you program microcomputers? (Y/N) ' */
inptynd
Summary:
char *inptynd(prompt,x);
char *prompt; /* Prompt for Input */
int x; /* Default Answer */
Created: 08/16/86 Last Updated: 08/16/86
Author: Bob Pritchett Source (C/A): C
Located in: INPUT.OBJ
Requires: Nothing.
Description:
This function works just like inptyn() except that the default
response is the uppercase letter in the prompt which will be
returned if a carriage return is entered instead of a Y or N.
Compiler Specifics:
None.
Return Value:
A one or zero, dependent on the inputted character, or the
default.
See Also:
inptyn() finptyn() finptynd();
Example:
if ( inptyn("Do you program microcomputers?",1) )
printf("Oh, you do.");
/* Prompts 'Do you program microcomputers? (Y/n) ' */
isleap
Summary:
int isleap(y);
int y; /* Year */
Created: 09/01/86 Last Updated: 09/01/86
Author: George Roukas Source (C/A): C
Located in: CSRDATE.OBJ
Requires: Nothing.
Description:
This function will tell if the specified year (four or two digit
format) is a leap year.
Compiler Specifics:
None.
Return Value:
Returns a one if it is a leap year, zero if it is not.
See Also:
Example:
int x = 1986;
if ( isleap(x) )
printf("%d is a leap year.\n");
iswild
Summary:
#include <csrmisc.h> /* Header File Containing the Macro */
int iswild(c);
int c; /* Character to Test */
Created: 12/05/86 Last Updated: 12/05/86
Author: Bob Pritchett Source (C/A): C
Located in: CSRMISC.H
Requires: Nothing.
Description:
This macro evaluates positive if the given character is a '?' or
an '*'.
Compiler Specifics:
None.
Return Value:
Acts positive if the character is a wildcard, negative if not.
See Also:
istemplate()
Example:
if ( iswild('?') )
printf("This character is a wild card.\n");
/* The printf statement is executed. */
istemplate
Summary:
int istemplate(str);
char *str; /* String to Evaluate */
Created: 12/05/86 Last Updated: 12/05/86
Author: Bob Pritchett Source (C/A): C
Located in: WILDCARD.OBJ
Requires: Nothing.
Description:
This function returns a one if a wildcard is encountered within
the given string. By using this function it can be determined
whether a file may be opened or if the string should be passed to
the ffirst() and fnext() routines.
Compiler Specifics:
None.
Return Value:
Returns a one if a wildcard is encountered, zero if not.
See Also:
iswild()
Example:
if ( istemplate("file*.e?w") )
printf("The filename given is a template.\n");
/* The printf statement is executed. */
itofa
Summary:
int itofa(x,str);
int x; /* Integer to Format */
char *str; /* Location to Place String */
Created: 11/07/85 Last Updated: 11/07/86
Author: Bob Pritchett Source (C/A): C
Located in: IOTFA.OBJ
Requires: Nothing.
Description:
This function takes an integer and returns a string with that
integer formatted with commas. The string is placed in str and a
pointer is returned to it.
Compiler Specifics:
None.
Return Value:
Returns a pointer to the formatted string.
See Also:
ltofa()
Example:
int x = 12526;
char temp[10];
printf("There are %s people in this county.\n",itofa(x,temp));
/* Returns "12,526". */
lprint
Summary:
int lprint(string);
char *string; /* String to Print */
Created: 03/10/86 Last Updated: 03/11/86
Author: Bob Pritchett Source (C/A): C
Located in: PRINT.OBJ
Requires: lputchar()
Description:
This function simply prints the string to the printer. Nothing
other then the standard escape codes are recognized.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
wprint()
Example:
lprint("This string has no formatting at all.\n");
lprintf
Summary:
int lprintf(string[,arguments...]);
char *string; /* Format String to Print */
Created: 03/10/86 Last Updated: 08/17/86
Author: Bob Pritchett Source (C/A): C
Located in: PRINT.OBJ
Requires: Nothing.
Description:
This function is a version of the familiar printf() function that
prints directly to the printer. (Note that DOS function 5 is
used, it is not done through file pointers.) The argument
formatting should be in the same format as for printf().
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
wprintf()
Example:
lprintf("This goes to the printer: %02d %5s\n",6,"Wow");
lputchar
Summary:
int lputchar(c);
int c; /* Character to Print */
Created: 03/10/86 Last Updated: 03/11/86
Author: Bob Pritchett Source (C/A): C
Located in: PRINT.OBJ
Requires: bdos()
Description:
Using the bdos call five this routine simply puts the character c
to the printer. It is called by lprint().
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
lprint() lprintf()
Example:
lputchar('\r');
ltofa
Summary:
int ltofa(x,str);
long x; /* Long to Format */
char *str; /* Location to Place String */
Created: 11/07/85 Last Updated: 11/07/86
Author: Bob Pritchett Source (C/A): C
Located in: LOTFA.OBJ
Requires: Nothing.
Description:
Performing just like itofa(), this function formats the given
number into an ASCII string with commas.
Compiler Specifics:
None.
Return Value:
Returns a pointer to the formatted string.
See Also:
itofa()
Example:
long x = 2364736;
char temp[15];
printf("There are %s apples in this county.\n",ltofa(x,temp));
/* Returns "2,364,736". */
match
Summary:
int match(pat,str,start);
char pat[]; /* Pattern to Search for */
char str[]; /* String to Search in */
int start; /* Character to Start on */
Created: 11/23/85 Last Updated: 11/23/85
Author: Bob Pritchett Source (C/A): C
Located in: MATCH.OBJ
Requires: strlen()
Description:
The match() function searches the string str for the string pat,
and returns an integer value of the first place pat is found
within str. By changing the variable start from it's normal
useage as 0, you may begin the search from a certain place in
str. The following wildcards are acceptable within pat:
# Any digit from 1-9, and 0
? Any character at all
! Any upper-case letter
^ Any control character
Compiler Specifics:
None.
Return Value:
Returns the first place that pat is found within str.
See Also:
Example:
x = match("a?c","xyzabc",0); /* x = 3, where abc begins. */
mcolor
Summary:
#include <color.h> /* For Color Definitions Only */
int mcolor(norm,bar);
int norm; /* Color Used for Menu Options */
int bar; /* Color for Hightlight Bar */
Created: 04/16/86 Last Updated: 04/16/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function sets the colors to be used by pop_menu() and it's
scrolling highlight bar. The variable norm contains the complete
attribute for each option, and bar for the highlight bar.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
color() wcolor()
Example:
#include <color.h>
mcolor(WHT_F+BLU_B,YEL_F+RED_B);
message
Summary:
int message(mess,x);
char *mess; /* Message to Display */
int x; /* Flag for Window Message */
Created: 08/09/86 Last Updated: 08/09/86
Author: Bob Pritchett Source (C/A): C
Located in: MESSAGE.OBJ
Requires: Nothing.
Description:
This function opens a small window in the current color and
displays the string specified in mess. If the variable x is set
to one, the message "[ Hit a Key ]" is displayed on the bottom of
the window. A single keystroke closes the window, and the key
value is returned.
Compiler Specifics:
None.
Return Value:
The key used to close the window.
See Also:
Example:
message("** Attempt to Open File Failed **",1);
month_day
Summary:
int month_day(yr,yd,m,d);
int yr; /* Year To Calculate For */
int yd; /* Number of Days Elapsed in Year */
int *m; /* Where to Store Month */
int *d; /* Where to Store Day */
Created: 09/01/86 Last Updated: 09/01/86
Author: George Roukas Source (C/A): C
Located in: CSRDATE.OBJ
Requires: isleap()
Description:
Similar to the K&R (pp 103-104) routine of the same name, this
function calculates the menth and day of the year when given the
year and number of days elapsed in that year.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
date_sn() sn_date() isleap()
Example:
int m;
int d;
month_day(1986,3,&m,&d);
printf("%02d/%02d is 3 days into 1986.\n",m,d);
/* Will output: 01/03 is.... */
num_days
Summary:
int num_days(m,y);
int m; /* Month to Get Number of Days For */
int y; /* Year */
Created: 12/27/85 Last Updated: 12/27/85
Author: Bob Pritchett Source (C/A): C
Located in: CSRDATE.OBJ
Requires: isleap()
Description:
This function returns the number of days in the month specified,
leap years taken into account.
Compiler Specifics:
None.
Return Value:
The number of days.
See Also:
date_sn() sn_date() isleap() chk_date()
Example:
printf("%d days in February, 1980.\n",num_days(2,1980));
num_drives
Summary:
int num_drives();
Created: 04/06/86 Last Updated: 04/06/86
Author: Bob Pritchett Source (C/A): A
Located in: NUMDRVS.OBJ
Requires: Nothing.
Description:
This function returns a single integer value, the number of
logical drives available. Remember that although this function
returns the number of available drives, access to these drives is
numbered from zero, so if 3 drives are reported, the highest
number that may be accessed is 2.
Compiler Specifics:
None.
Return Value:
The total number of logical drives installed.
See Also:
get_drive() set_drive()
Example:
printf("%d drives installed. A: - %c:\n",num_drives(),
( 'A' + ( num_drives() - 1 ) ));
pmenu
Summary:
#include <csrmenu.h> /* Contains MENU typedef */
int pmenu(menu)
MENU menu; /* Pointer to Menu Structure */
Created: 08/08/86 Last Updated: 08/20/86
Author: Bob Pritchett Source (C/A): C
Located in: MENU.OBJ
Requires: Nothing.
Description:
This function will display a pop up menu and allow for selection
of an item with the arrow keys, or the space and backspace keys.
The differences between pmenu() and pop_menu() are mostly in the
calling method. By using a data element of the MENU type as the
only argument, the number of parameters specifiable is increased,
allowing for better control of the menu, while the number of
function arguments is reduced to one for cleaner coding.
If the first character in an item name is a hyphen, the item will
be a horizontal line of the border color and type. If the return
value of an element is a negative one, the item is non
selectable.
Note, unlike pop_menu(), pmenu() will center the text of each
entry to the width of the largest entry. If you place a space on
each side of only the largest (widest) entry in a menu structure,
all menu options will have at least one space on each side.
For information on specification of menus, read the description
of CSRMENU.H.
Compiler Specifics:
None.
Return Value:
The value of the menu item selected or a -1 for failure.
See Also:
pop_menu()
pmenu
Example:
#include <csrmenu.h>
#include <color.h>
MENU mnu;
main()
{
int x;
strcpy(mnu->title,"Menu");
mnu->type = 3;
mnu->border = WHT_F+BLU_B;
mnu->normal = RED_F+WHT_B;
mnu->bar = WHT_F+RED_B;
mnu->row = 6;
mnu->col = 20;
mnu->num = 4;
strcpy(mnu->entry[0].text,"Help");
mnu->entry[0].value = 1;
strcpy(mnu->entry[1].text,"Exit");
mnu->entry[1].value = 2;
strcpy(mnu->entry[2].text,"-");
mnu->entry[2].value = -1;
strcpy(mnu->entry[3].text," Static ");
mnu->entry[3].value = -1;
x = pmenu(mnu);
if ( x == -1 )
exit(1);
else if ( x == 1 )
help();
else
exit(0);
.
.
.
}
pop_menu
Summary:
int pop_menu(x,y,num,args,title,type);
int x; /* Row to Start on */
int y; /* Col to Start on */
int num; /* Number of Options */
char *args[]; /* Function Names */
char *title; /* Menu Title */
int type; /* Window Type */
Created: 03/09/86 Last Updated: 03/09/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: wopen() wclose() wtitle()
Description:
This function opens a window at x,y titled with the string
pointed to by title, of type border style, and with num options
stored in args[]. The window's width is the size of the maximum
length option. The options are printed as sent to the routine,
but for a clean highligh bar, and better performance all the
options should be centered previously in a string. See the demo
programs for more examples of this. Also note, after an option
is selected with the highlight bar, the it's number is returned,
and the window closed. You must reopen the menu, this preferably
done in a loop[ structure that opens the menu, processes the
resulting code, and then reopens the menu. This system is a
simple building block for more advanced menu design.
Compiler Specifics:
See window notes.
Return Value:
The number of the option selected with the highlight bar, or a -1
signifying the user aborted the menu with the ESC key.
See Also:
mcolor()
pop_menu
Example:
#include <color.h>
static char *array[] =
{
" Option 1 ",
" Option 2 ",
" Quit "
};
main()
{
int x;
cls();
while ( 1 )
{
/* Inside doesn't matter, mcolor() does that, so we use wcolor
only to set our border. Then mcolor() will set our menu
colors. (Color definition in loop in case other routines
change them.) */
wcolor(BLK_F,BLU_F+WHT_B);
mcolor(YEL_F+RED_B,WHT_F+BLU_B);
x = pop_menu(9,27,3,array," Menu ",3);
if ( x == 0 )
opt1();
else if ( x == 1 )
opt2();
else if ( x == 2 || x == -1 )
exit(0);
}
}
print_screen
Summary:
int print_screen();
Created: 03/10/86 Last Updated: 03/10/86
Author: Bob Pritchett Source (C/A): C
Located in: PRINT.OBJ
Requires: int86()
Description:
Performing the exact same feature as if you had hit the PrtSc key
while holding the shift key down, this routine prints the screen
with the bios interrupt five.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
Example:
print_screen();
prtrns
Summary:
int prtrns(c);
int c; /* Character to translate */
Created: 02/22/86 Last Updated: 02/22/86
Author: Bob Pritchett Source (C/A): C
Located in: PRTRNS.C PRTRNS.OBJ
Requires: Nothing.
Description:
This function is a simple one that takes c as an argument, and if
it is a special box drawing character form the extended character
set it is translated into an equivalent in the lower 127 ASCII
range. Possibly useful in writing a screen or text dump that
originally contained special characters.
Compiler Specifics:
None.
Return Value:
Returns the character, translated if neccessary.
See Also:
Example:
#include <stdio.h>
int c = 179;
c = prtrns(c); /* Would return |, replacing 179. */
putc(c,stdprn);
putat
Summary:
int putat(x,y,string);
int x; /* Row to Put At */
int y; /* Col to Put At */
char *string; /* String to Put */
Created: 12/28/85 Last Updated: 12/28/85
Author: Bob Pritchett Source (C/A): C
Located in: PUTAT.OBJ
Requires: ccputs() putchci()
Description:
This function places the specified string at x,y on the global
screen.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
putatf() wputat() wputatf()
Example:
putat(10,25,"+ The plus is at 10,25.");
putatf
Summary:
int putatf(x,y,string,args...);
int x; /* Row to Put At */
int y; /* Col to Put At */
char *string; /* Formatted String to Put */
args... /* Formatting Arguments */
Created: 05/01/86 Last Updated: 08/20/86
Author: Bob Pritchett Source (C/A): C
Located in: PUTATF.OBJ
Requires: ccputs() putchci()
Description:
This performs the same function as putat() with the addition of
up to 15 formatting arguments in the same format as printf().
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
putat() wputat() wputatf()
Example:
putatf(10,25,"+ The plus %s at %d,%d.","is",10,25);
putchc
Summary:
int putchc(c,color);
int c; /* Character to Print */
int color; /* Attribute to Use */
Created: 09/25/86 Last Updated: 09/25/86
Author: Bob Pritchett Source (C/A): A
Located in: PUTCHC.OBJ
Requires: Nothing.
Description:
This function simply outputs the character and attribute without
incrementing the cursor.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
putchci() wputchar()
Example:
#include <color.h>
putchc('C',GRN_F+BLK_B); /* Put out a C in green. */
putchci
Summary:
int putchci(c,color);
int c; /* Character to Print */
int color; /* Attribute to Use */
Created: 12/28/85 Last Updated: 09/25/86
Author: Bob Pritchett Source (C/A): A
Located in: PUTCHCI.OBJ
Requires: Nothing.
Description:
This simply outputs the character c, using the color in color, to
the video memory, and then increments the cursor.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
wputchar()
Example:
#include <color.h>
putchci('A',RED_F+BLK_B); /* Put out an A in red. */
read_tmr
Summary:
unsigned read_tmr(x);
int x; /* The Number of the Counter to Use */
Created: 01/03/87 Last Updated: 01/03/87
Author: Dave Perras Source (C/A): C
Located in: TIMERS.C TIMERS.OBJ
Requires: get_timer()
Description:
This function reads the specified timer and returns, in tenths of
seconds, the difference between the stored time and the current.
Compiler Specifics:
None.
Return Value:
An unsigned value representing the tenths of seconds which have
elapsed since the start_tmr() function was called for this timer.
If the specified timer has not been initialized or has not been
started an error value of zero is returned.
See Also:
get_timer() start_tmr() stop_tmr() reset_tmr() zero_tmr() timer()
init_tmr()
Example:
init_tmr(); /* Initialize Timers */
start_tmr(5); /* Start timer number 5. */
printf("%d seconds have elapsed.\n",10 * read_tmr(5));
/* The above statement does not stop the timer. */
reset_tmr
Summary:
void reset_tmr(x);
int x; /* The Number of the Counter to Use */
Created: 01/03/87 Last Updated: 01/03/87
Author: Dave Perras Source (C/A): C
Located in: TIMERS.C TIMERS.OBJ
Requires: Nothing.
Description:
This function zeros the specified timer and clears its active
flag.
Compiler Specifics:
None.
Return Value:
Nothing is returned.
See Also:
get_timer() start_tmr() stop_tmr() read_tmr() zero_tmr() timer()
init_tmr()
Example:
init_tmr(); /* Initialize Timers */
start_tmr(5); /* Start timer number 5. */
printf("%d seconds have elapsed.\n",10 * read_tmr(5));
/* The above statement does not stop the timer. */
reset_tmr(5); /* Stop and reset timer 5. */
restore
Summary:
int restore(x,y,x2,y2,array);
int x; /* Upper Left Row */
int y; /* Upper Left Col */
int x2; /* Lower Right Row */
int y2; /* Lower Right Col */
char *array; /* Array to Store Screen In */
Created: 03/03/86 Last Updated: 03/03/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function restores the portion of the screen previously saved
by save() in array at the coordinates which are specified, which
don't have to be the same as those at which it was saved.
Compiler Specifics:
The MSC function movedata() was used.
Return Value:
Nothing is returned and there are no validity checks. Giving a
set of bad coordinates will generate unknown results.
See Also:
save() restore_screen()
Example:
char *temp;
temp = malloc(4000); /* Size of screen and attributes. */
save(0,0,24,79,temp); /* Save whole screen. */
restore(0,0,24,79,temp); /* Restore screen. */
restore_cursor
Summary:
int restore_cursor();
Created: 02/22/86 Last Updated: 02/24/86
Author: Bob Pritchett Source (C/A): C
Located in: CURSOR.OBJ
Requires: int86()
Description:
This function will return the cursor to the location it was at
when save_cursor() was called.
Compiler Specifics:
Problems associated with int86() only.
Return Value:
Nothing.
See Also:
save_cursor() restore_screen()
Example:
save_cursor();
restore_cursor();
restore_screen
Summary:
int restore_screen();
Created: 03/09/86 Last Updated: 10/23/86
Author: Bob Pritchett Source (C/A): C
Located in: SRSCREEN.OBJ
Requires: restore()
Description:
This function restores the screen saved with save_screen().
Useful for restoring the screen present when a program was
invoked after it finishes executing.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
save_screen() restore_cursor()
Example:
main()
{
save_screen();
/* Etc... */
restore_screen();
exit(0);
}
retrace
Summary:
int retrace(x);
int x; /* Type of Retrace to Test For */
Created: 06/06/86 Last Updated: 06/06/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This routine determines which retrace to move data into video
memory under. The value can be 1, (FAST) which represents data
movement during the horizontal retrace, or 8, (SLOW) which causes
data to be moved during the vertical retrace. The fast/slow
adjectives have little to do with the data movement due to the
number of screen repaints per second. The default is vertical
retrace, 8, and the main purpose of this function is to allow
an alternate method if desirable on some monitors.
Compiler Specifics:
None.
Return Value:
Returns -1 if a value other then 1 or 8 is passed.
See Also:
dma()
Example:
retrace(8);
/* Change to data movement during vertical retrace. */
save
Summary:
int save(x,y,x2,y2,array);
int x; /* Upper Left Row */
int y; /* Upper Left Col */
int x2; /* Lower Right Row */
int y2; /* Lower Right Col */
char *array; /* Array to Store Screen In */
Created: 03/03/86 Last Updated: 03/03/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function saves the portion of the screen specified by the
four coordinates into array. No other action is taken, and the
screen is not erased within that area.
Compiler Specifics:
The MSC function movedata() was used.
Return Value:
Nothing is returned and there are no validity checks. Giving a
set of bad coordinates will generate unknown results.
See Also:
restore() save_screen()
Example:
char *temp;
temp = malloc(4000); /* Size of screen and attributes. */
save(0,0,24,79,temp); /* Save whole screen. */
restore(0,0,24,79,temp); /* Restore screen. */
save_cursor
Summary:
int save_cursor();
Created: 02/22/86 Last Updated: 02/24/86
Author: Bob Pritchett Source (C/A): C
Located in: CURSOR.OBJ
Requires: int86()
Description:
This funciton will save the current cursor position in an
internal variable for restoration with restore_cursor() at a
later time.
Compiler Specifics:
int86().
Return Value:
Nothing.
See Also:
restore_cursor()
Example:
save_cursor(); /* Save it here... */
printf("This is a string of text...");
restore_cursor(); /* To the beginning of the line... */
save_screen
Summary:
int save_screen();
Created: 03/09/86 Last Updated: 10/23/86
Author: Bob Pritchett Source (C/A): C
Located in: SRSCREEN.OBJ
Requires: save()
Description:
This function saves the current screen and attributes for later
restoration with the restore_screen() function.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
save_cursor() restore_screen()
Example:
main()
{
save_screen();
/* Etc... */
restore_screen();
exit(0);
}
scroll
Summary:
int scroll(x,y,x2,y2,dir,num);
int x; /* Upper Left Row */
int y; /* Upper Left Col */
int x2; /* Lower Right Row */
int y2; /* Lower Right Col */
int dir; /* 0 - Up / 1 - Down */
int num; /* Number of Lines */
Created: 03/03/86 Last Updated: 03/03/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: int86()
Description:
This function scrolls the area inside and including the specified
coordinates in the specified window. The number of lines
scrolled is determined by the value of num and setting num to 0
and the direction 0, up, will cause the window to clear
completly.
Compiler Specifics:
None other then int86() related.
Return Value:
Nothing.
See Also:
wscroll()
Example:
scroll(0,0,24,80,0,0); /* Clear the whole screen. */
set_date
Summary:
int set_date(dy,mn,yr);
int dy; /* Day */
int mn; /* Month */
int yr; /* Year */
Created: 03/31/86 Last Updated: 03/31/86
Author: Bob Pritchett Source (C/A): C
Located in: SET_DATE.OBJ
Requires: intdos()
Description:
Using the DOS interrupts this routine sets the date as specified
in the three parameters. For more information see the
description of get_date();
Compiler Specifics:
Compiled with MSC 3.0, uses the dosint() function and register
unions specified in DOS.H.
Return Value:
Nothing.
See Also:
get_dow() get_date() set_time()
Example:
int d = 4;
int m = 7;
int y = 1987;
set_date(d,m,y); /* Fourth of July, 1987. */
set_drive
Summary:
int set_drive(x);
int x; /* Drive Numer to Set to */
Created: 04/06/86 Last Updated: 04/06/86
Author: Bob Pritchett Source (C/A): A
Located in: SETDRIVE.OBJ
Requires: Nothing.
Description:
This function sets the current drive to the number specified by
x. For an explanation of numbering conventions, see get_drive().
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
get_drive() num_drives()
Example:
if ( num_drives() != 1 ) /* If we have more then 2 logical */
set_drive(2); /* Make the current the first HD, C: */
else
set_drive(0); /* Else make it A: */
set_mode
Summary:
#include <csrmodes.h> /* For Declarations Only */
int set_mode(x);
int x; /* Video Mode to Set to */
Created: 05/03/86 Last Updated: 08/27/86
Author: Bob Pritchett Source (C/A): A
Located in: SETMODE.OBJ
Requires: Nothing.
Description:
This function sets the video mode as specified in x. Please see
CSRMODES.H for a description of these modes.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
get_mode()
Example:
#include <csrmodes.h>
set_mode(CO80); /* 80 Columns - Color */
set_time
Summary:
int set_time(hr,mn,sc,hn);
int hr; /* Hour */
int mn; /* Minutes */
int sc; /* Seconds */
int hn; /* Hundredths */
Created: 03/31/86 Last Updated: 03/31/86
Author: Bob Pritchett Source (C/A): C
Located in: SET_TIME.OBJ
Requires: intdos()
Description:
This routine uses DOS to set the current time as specified. For
more information see the description of get_time().
Compiler Specifics:
Compiled with MSC 3.0, uses the dosint() function and register
unions specified in DOS.H.
Return Value:
Nothing.
See Also:
get_dow() set_date() get_time()
Example:
int h = 3;
int m = 15;
int s = 0;
int hn = 0;
set_time(h,m,s,hn); /* Set the time to 3:15am. */
sn_date
Summary:
unsigned int sn_date(sn,m,d,y);
unsigned int sn; /* Serial Number to Convert to Date */
int *m; /* Location to Store Month */
int *d; /* Location to Store Day */
int *y; /* Location to Store Year */
Created: 09/01/86 Last Updated: 09/01/86
Author: Bob Pritchett Source (C/A): C
Located in: CSRDATE.OBJ
Requires: isleap()
Description:
This routine will turn serial numbers created by date_sn() into
dates.
Compiler Specifics:
None.
Return Value:
Returns a zero if the serial number is invalid, else returns a
one.
See Also:
date_sn() valid_date() isleap() dt_diff()
Example:
int m;
int d;
int y;
int sn;
sn = date_sn(12,25,86); /* Convert to serial number. */
/* . . . Modify/Manipulate Serial Number . . . */
sn_date(sn,&m,&d,&y); /* Convert back to date. */
sound
Summary:
#include <csrsound.h> /* Only for Note Definitions */
int sound(tone,duration);
int tone; /* Frequency in Hertz */
int duration; /* Length in Milliseconds */
Created: 05/12/86 Last Updated: 05/12/86
Author: Bob Pritchett Source (C/A): C
Located in: CSRSOUND.OBJ
Requires: Nothing.
Description:
This routine will sound the specified frequency for the length of
time, in milliseconds, specified in duration. The function does
not return until the sound has completed playing.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
Example:
#include <csrsound.h>
sound(C,500);
sound(D,250);
sound(E,125);
soundex
Summary:
int soundex(name,code);
char *name; /* Name to Process */
char *code; /* String to Hold Code */
Created: 00/00/00 Last Updated: 06/08/86
Author: David Lovelock Source (C/A): C
Located in: SOUNDEX.OBJ
Requires: Nothing.
Description:
This routine will, for any given name, return a code value
representing it. This code value will be the same as values for
similar sounding names. The code consists of the first letter of
the name, followed by three digits and a NULL.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
Example:
/* All should return an identical code. */
char code[5];
soundex("MacHew",code);
printf("MacHew: %s.\n",code);
soundex("MacKew",code);
printf("MacKew: %s.\n",code);
soundex("McQue",code);
printf("McQue: %s.\n",code);
start_tmr
Summary:
void start_tmr(x);
int x; /* The Number of the Counter to Use */
Created: 01/03/87 Last Updated: 01/03/87
Author: Dave Perras Source (C/A): C
Located in: TIMERS.C TIMERS.OBJ
Requires: get_timer()
Description:
This function will begin tracking the elapsed time using the
timer number given. This is done by reading and storing the
value of the real time clock.
Compiler Specifics:
None.
Return Value:
Nothing is returned.
See Also:
get_timer() stop_tmr() read_tmr() reset_tmr() zero_tmr() timer()
init_tmr()
Example:
init_tmr(); /* Initialize Timers */
start_tmr(2); /* Start timer number 2. */
stop_tmr
Summary:
unsigned stop_tmr(x);
int x; /* The Number of the Counter to Use */
Created: 01/03/87 Last Updated: 01/03/87
Author: Dave Perras Source (C/A): C
Located in: TIMERS.C TIMERS.OBJ
Requires: get_timer()
Description:
This function will first read the current setting of the real
time clock, determine the difference in tenths of seconds between
the stored and current time, and then zero the specified timer
and reset its active flag.
Compiler Specifics:
None.
Return Value:
An unsigned value representing the tenths of seconds which have
elapsed since the start_tmr() function was called for this timer.
The maximum interval over which the timer is accurate is
determined by the size of an unsigned int, which for most
compilers results in an approximate limit of 1.8 hours.
See Also:
get_timer() start_tmr() read_tmr() reset_tmr() zero_tmr() timer()
init_tmr()
Example:
init_tmr(); /* Initialize Timers */
start_tmr(5); /* Start timer number 5. */
printf("%d seconds have elapsed.\n",10 * stop_tmr(5));
strcen
Summary:
strcen(string,result,width);
char *string; /* String to Center */
char *result; /* Where to Put It */
int width; /* Width to Center on */
Created: 03/03/86 Last Updated: 09/17/86
Author: Bob Pritchett Source (C/A): C
Located in: STRCEN.OBJ
Requires: strtrm()
Description:
This routine places string into result with the appropriate
amount of preceding and trailing spaces. The length of result
will be width. Note that the string is trimmed (See strcen().)
before it is centered, and that an uneven number of spaces on
each side results in the extra space being tagged to the end.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
strtrm() strlft() strght() center()
Example:
char temp[25];
strcen(" Centered ",temp,20);
printf("Centered String:\n 12345678901234567890\n>%s<\n",temp);
/* Results in > Centered < */
strght
Summary:
strght(string,result,width);
char *string; /* String to Right Justify */
char *result; /* Where to Put It */
int width; /* Width to Justify in */
Created: 09/07/86 Last Updated: 09/17/86
Author: Bob Pritchett Source (C/A): C
Located in: STRGHT.OBJ
Requires: strtrm()
Description:
This routine will right justify the given string, placing the
result in the specified variable. The string will be trimmed
with strtrm() before the justification.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
strcen() strlft() strtrm()
Example:
char temp[25];
strght(" Right Just. ",temp,20);
printf("Justified String:\n 12345678901234567890\n>%s<\n",temp);
/* Results in > Right Just.< */
strlft
Summary:
strlft(string,result,width);
char *string; /* String to Left Justify */
char *result; /* Where to Put It */
int width; /* Width to Justify in */
Created: 09/07/86 Last Updated: 09/17/86
Author: Bob Pritchett Source (C/A): C
Located in: STRLFT.OBJ
Requires: strtrm()
Description:
This routine will left justify the given string, placing the
result in the specified variable. The string will be trimmed
with strtrm() before the justification.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
strcen() strght() strtrm()
Example:
char temp[25];
strght(" Left Just. ",temp,20);
printf("Justified String:\n 12345678901234567890\n>%s<\n",temp);
/* Results in >Left Just. < */
strtrm
Summary:
strtrm(string,result);
char *string; /* String to Trim */
char *result; /* Where to Put It */
Created: 09/07/86 Last Updated: 09/17/86
Author: Bob Pritchett Source (C/A): C
Located in: STRTRM.OBJ
Requires: Nothing.
Description:
This routine trims all preceding and trailing spaces from a
string, while preserving spaces inside the string.
Compiler Specifics:
None.
Return Value:
The length of the new string.
See Also:
strcen() strght() strlft()
Example:
char temp[25];
strtrm(" Trim This. ",temp);
printf("Trimmed String:\n>%s<\n",temp);
/* Results in >Trim This.< */
timer
Summary:
int timer();
Created: 04/14/86 Last Updated: 04/14/86
Author: Unknown Source (C/A): C
Located in: TIMER.OBJ
Requires: int86()
Description:
This routine will return an integer representing the number of
clock ticks since the last call. Remember that there are about
18.2 ticks per second.
Compiler Specifics:
None.
Return Value:
The number of ticks since last call.
See Also:
Example:
timer(); /* Start count... */
routine();
printf("routine() took %d ticks to execute.\n",timer());
valid_date
Summary:
int valid_date(m,d,y);
int m; /* Month to Check */
int d; /* Day to Check */
int y; /* Year to Check */
Created: 09/01/86 Last Updated: 09/01/86
Author: George Roukas Source (C/A): C
Located in: CSRDATE.OBJ
Requires: isleap()
Description:
This function performs in a manner similar to that of chk_date()
with the exception that it verifies that the year is between 1900
and 2050, in order to be compatible with date_sn() and sn_date().
Compiler Specifics:
None.
Return Value:
Evaluates as true if the date is valid, false if it is not.
See Also:
chk_date() date_sn() sn_date() isleap()
Example:
if ( valid_date(6,15,1791) ) /* Evaluates as False */
function();
if ( valid_date(6,15,1971) ) /* Evaluates as True */
otherwise();
vidblt
Summary:
vidblt(ss,so,ds,do,x);
int ss; /* Segment Address of Source */
int so; /* Segment Offset of Source */
int ds; /* Segment Address of Destination */
int do; /* Segment Offset of Destination */
int x; /* Number of Bytes to Move */
Created: 00/00/85 Last Updated: 00/00/85
Author: Philip A. Mongelluzzo Source (C/A): A
Located in: SNOWLESS.OBJ
Requires: Uses _csrbit in COUTPUT.OBJ to determine retrace mode.
Description:
This routine is similar to Microsoft's movedata() except that it
is used for moving data (with the same parameters) to and from
the color monitor memory without causing snow or flicker.
Compiler Specifics:
Uses Microsoft's assembly header and footer.
Return Value:
No return value.
See Also:
Example:
/* Contact Bob Pritchett if you need to use it independantly. */
wactivate
Summary:
int wactivate(wind);
int wind; /* Pointer to Window to Activate */
Created: 03/03/86 Last Updated: 03/09/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function activates the specified window. If the window is
overlayed by other windows it is brought out from behind and
becomes the active window, on top of the other and uncovered.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
wclose() wopen()
Example:
wactivate(w3); /* Activate an opened window */
wblank
Summary:
int wblank(wind,row);
int wind; /* Pointer to Window to Use */
int row; /* Row to Clear */
Created: 04/30/86 Last Updated: 04/30/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function will erase the specified row within the specified
window by deleting then inserting that row. The cursor is place
at column 0 in this row.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
winsert() wdelete()
Example:
wblank(win,3);
wborder
Summary:
int wborder(num,type);
int num; /* Number of Window to Use */
int type; /* Type of Window Border to Use */
Created: 04/25/86 Last Updated: 04/25/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function redraws the border of a window, using whatever type
is specified, and the colors stored for this window. The most
useful purpose is to 'erase' wtitle() and wmessage() messages,
and to change the style of the border.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
wcolor()
Example:
wborder(win,4);
wcenter
Summary:
int wcenter(win,x,str);
int win; /* Window to Use */
int x; /* Line to Center on */
char *str; /* String to Center */
Created: 03/03/86 Last Updated: 03/03/86
Author: Bob Pritchett Source (C/A): C
Located in: WCENTER.OBJ
Requires: wgotoxy() wprint()
Description:
This routine is functionally the same as center() except that x
is a line within the specified window, and the string is centered
in window coordinates, not global. The window's inside color is
used.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
wcenterf() center()
Example:
wcenter(w3,5,"This is centered in window 3.");
wcenterf
Summary:
int wcenterf(win,x,str[,arguments...]);
int win; /* Window to Use */
int x; /* Line to Center on */
char *str; /* String to Center */
Created: 04/13/86 Last Updated: 08/17/86
Author: Bob Pritchett Source (C/A): C
Located in: WCENTERF.OBJ
Requires: wgotoxy() wprint()
Description:
Just like centerf() only in the specified window.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
center() centerf() wcenter()
Example:
wcenterf(w3,5,"This is %s in window 3.","centered");
wclose
Summary:
int wclose(wind);
int wind; /* Pointer to Window to Close */
Created: 03/03/86 Last Updated: 03/09/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function closes a video window previously opened with
wopen(). The portion of the screen that was covered with the
window is restored. NOTE: You may close a window other then the
active one, it will be acitivated and properly closed.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
wcloseall() wopen() wactivate()
Example:
int w;
w = wopen(10,10,20,70,2); /* Open a large window */
wclose(w); /* Restore covered screen area */
wcloseall
Summary:
int wcloseall();
Created: 03/03/86 Last Updated: 03/09/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function closes all the open windows by repeatedly calling
wclose(). The active window is closed first, and so on all the
way down the stack.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
wclose() wopen() wactivate()
Example:
int w;
int w2;
w = wopen(10,10,20,70,2); /* Open a large window */
w2 = wopen(5,5,17,54,3);
wcloseall(); /* Restore covered screen area */
wcls
Summary:
int wcls(num);
Created: 03/03/86 Last Updated: 03/09/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This routine will clear the specified window with it's current
interior attributes. If not active the cleared window will
become the foremost window.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
cls() ccls()
Example:
wcls(win); /* Clear window win. */
wcol
Summary:
int wcol(wind);
int wind; /* Pointer to Window to Use */
Created: 03/03/86 Last Updated: 03/09/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function returns the number of the highest col in a window.
If a window has siz columns, numbered zero to five, wcol() will
return a five. Mostly an internal routine.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
wrow()
Example:
x = wcol(w3); /* Returns the number of highest row */
wcolor
Summary:
int wcolor(insd,bord);
int insd; /* Color For Window Interior */
int bord; /* Color For Window Border */
Created: 03/03/86 Last Updated: 03/09/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This routine sets the current colors for the inside and outside
of windows. These are the defaults used when a window is
created. The difference between color() and wcolor() primarily
is that color has two arguments, the fore and background colors,
and wcolor makes you add the fore and back into one number for
both the inside and border colors. Also, the color() function
sets both border and inside attributes to be the same, while
wcolor() allows them to be set to different values.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
color()
Example:
wcolor(WHT_F+BLU_B,BLU_F+WHT_F);
/* Inside is white on blue, border is blue on white. */
wdelete
Summary:
int wdelete(num,row,tms)
int num; /* Pointer to Window to Use */
int row; /* Row to Delete Line Before */
int tms; /* Number of Lines to Delete */
Created: 04/30/86 Last Updated: 04/30/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This routine deletes tms lines starting with the line number in
row, and moves all lower lines up, making blanks at the bottom of
the window.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
winsert() wblank()
Example:
wdelete(win,2,4); /* Delete 4 line starting with line 2,
so line 6 becomes line 2 etc. */
wfchar
Summary:
int wfchar(chr);
int chr; /* Character to Use in Fields */
Created: 10/19/86 Last Updated: 10/19/86
Author: Bob Pritchett Source (C/A): C
Located in: WFINPUT.OBJ
Requires: Nothing.
Description:
Behaving in a manner almost identical to that of fchar(), this
function will set the background character for window field
input, or, given an argument of -1, return the current value in
use. Note that this value is independant of the one used by
fchar(), although they both use the same default of the space
character.
Compiler Specifics:
None.
Return Value:
Returns the argument, or in the case of the argument being -1,
the current value of the window field background character.
See Also:
fchar() wfcolor() wffill() finptint() finptstr()
Example:
int w;
wfchar('*'); /* Set background to *'s. */
w = wopen(10,0,20,79,3);
wprintf(w,"The current background character is: %c.\n"
,wfchar(-1));
wfcolor
Summary:
#include <color.h> /* For Color Defintions Only */
int wfcolor(clr);
int clr; /* Color to Use in Window Fields */
Created: 10/19/86 Last Updated: 10/19/86
Author: Bob Pritchett Source (C/A): C
Located in: WFINPUT.OBJ
Requires: Nothing.
Description:
Behaving as does fcolor(), wfcolor() will set the field color for
window field input routines. This value is independant of the
one used by normal field routines, and the current value will be
returned if the argument is -1.
Compiler Specifics:
None.
Return Value:
Returns the argument, or in the case of the argument being -1,
the current value of the window field color.
See Also:
fcolor() wfchar() wffill() wfinptint() wfinptstr()
Example:
#include <color.h>
wfcolor(BLU_F+WHT_B); /* Blue on white. */
wffill
Summary:
int wffill(w,rw,cl,mx);
int w; /* Window in Which to Draw Field */
int rw; /* Row of Field (Within Window) */
int cl; /* Column of Field (Within Window) */
int mx; /* Length of Field */
Created: 12/05/86 Last Updated: 12/05/86
Author: Bob Pritchett Source (C/A): C
Located in: WFINPUT.OBJ
Requires: wgotoxy() cfield()
Description:
This function behaves similarly to ffill(), under whose heading
more information on the purpose of wffill() can be found.
Simply, the function uses the current window character and color
values to draw an input field in the specified window at the
coordinates given. (The row and column values are within the
window, not global.)
Compiler Specifics:
None.
Return Value:
Nothing is returned.
See Also:
ffill() wfchar() wfcolor() wfinptint() wfinptstr()
Example:
int w;
w = wopen(5,10,10,70,1);
wffill(w,10,20,10); /* At 10,20 a 10 character field. */
wputat(w,5,9,"Chrs: "); /* A prompt for the next field. */
wffill(w,5,15,6); /* At 5,15 a 6 character field. */
wgotoxy(w,5,15); /* Not needed, as wffill() leaves */
/* the cursor at the coordinates. */
ccputs("abc",fcolor(-1)); /* Put a default value on the */
/* screen with the field color. */
wfinptint
Summary:
int wfinptint(w,rw,cl,mx,x);
int w; /* Window to Use */
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
int *x; /* Where to Put Result */
Created: 10/19/86 Last Updated: 10/19/86
Author: Bob Pritchett Source (C/A): C
Located in: WFINPUT.OBJ
Requires: wgotoxy() cfield()
Description:
This function displays the specified field and then waits for
input of an integer just as does finptint(), under whose heading
a complete description can be found.
Compiler Specifics:
None.
Return Value:
The integer inputted is returned.
See Also:
inptint() wfinptintd() finptint() wffill() wfinptstr()
Example:
int x;
int w;
w = wopen(2,2,20,78,3);
wputat(w,5,10,"Num: "); /* A prompt for the next field. */
wfinptint(w,5,15,6,&x); /* At 5,15 a 6 character input. */
wprintf(w,"\n\n%d was the input.\n",x);
wfinptintd
Summary:
int wfinptintd(w,rw,cl,mx,x,d);
int w; /* Window to Use */
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
int *x; /* Where to Put Result */
int d; /* Default Integer */
Created: 10/19/86 Last Updated: 10/19/86
Author: Bob Pritchett Source (C/A): C
Located in: WFINPUT.OBJ
Requires: wgotoxy() cfield()
Description:
This function, which waits for input in a window field after
displaying a default value, behaves like finptintd(), where more
information can be found on its operation.
Compiler Specifics:
None.
Return Value:
The integer inputted is returned, or, in the case of a carriage
return, the default.
See Also:
inptintd() wfinptint() finptintd() wffill() wfinptstr()
Example:
int x;
int w;
w = wopen(3,3,22,77,'*');
wputat(w,5,10,"Num: "); /* A prompt for the next field. */
wfinptintd(w,5,15,4,&x,37); /* At 5,15 a 4 character input. */
if ( x == 37 )
wprintf(w,"\n\nThe default, 37, was returned.\n");
else
wprintf(w,"\n\n%d was the input.\n",x);
wfinptintr
Summary:
int wfinptintr(w,rw,cl,mx,x,lw,hg);
int w; /* Window to Use */
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
int *x; /* Where to Put Result */
int lw; /* Minimum Acceptable Value */
int hg; /* Maximum Acceptable Value */
Created: 10/19/86 Last Updated: 10/19/86
Author: Bob Pritchett Source (C/A): C
Located in: WFINPUT.OBJ
Requires: wfinptint()
Description:
This function, with the exception that it works within windows,
will act like finptintr(), waiting for an integer within its
specified range. All other input will cause the function to beep
and wait.
Compiler Specifics:
None.
Return Value:
The inputted integer, within the range, is returned.
See Also:
inptintr() wfinptint() finptintr() wffill() wfinptstr()
wfinptintrd()
Example:
int x;
int w;
w = wopen(1,1,23,78,'#');
wputat(w,5,10,"Num: "); /* A prompt for the next field. */
wfinptintr(w,5,15,4,&x,3,10);/* At 5,15 a 4 character input */
/* greater than 2 and less than */
/* ten. */
wfinptintrd
Summary:
int wfinptintrd(w,rw,cl,mx,x,lw,hg,d);
int w; /* Window to Use */
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
int *x; /* Where to Put Result */
int lw; /* Minimum Acceptable Value */
int hg; /* Maximum Acceptable Value */
int d; /* Default Value */
Created: 10/19/86 Last Updated: 10/19/86
Author: Bob Pritchett Source (C/A): C
Located in: WFINPUT.OBJ
Requires: wfinptintd()
Description:
This function behaves as does finptintrd(), only within the
specified window. Remember that the function makes no check to
see if the default is within the specified range, and if it is
not it will not be returnable.
Compiler Specifics:
None.
Return Value:
The inputted integer, within the range, is returned, or, in the
case of a carriage return as the first inputted character, the
default value.
See Also:
inptintr() wfinptintr() finptintrd() wffill() wfinptstr()
finptintr()
Example:
int x;
int w;
w = wopen(2,2,20,78,2);
wputat(w,5,10,"Num: "); /* A prompt for the next field. */
wfinptintrd(w,5,15,4,&x,3,10,5); /* At 5,15 a 4 character */
/* input greater than 2 and less */
/* than ten, or 5. */
wfinptstr
Summary:
int wfinptstr(w,rw,cl,mx,str);
int w; /* Window to Use */
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
char *str; /* Where to Place Input */
Created: 10/19/86 Last Updated: 10/19/86
Author: Bob Pritchett Source (C/A): C
Located in: WFINPUT.OBJ
Requires: wgotoxy() cfield()
Description:
This function is the windowing equivalent of finptstr() and
performs just like it. See the description of finptstr() for
more information on this routine.
Compiler Specifics:
None.
Return Value:
A pointer to a duplicate of the inputted string is returned, via
strdup().
See Also:
inptstr() finptstr() wfinptint() wffill() wfinptstr()
wfinptstrd()
Example:
char temp[80];
int w;
w = wopen(1,1,20,78,1);
wfinptstr(w,10,10,25,temp);
wfinptstrd
Summary:
int wfinptstrd(w,rw,cl,mx,str,def);
int w; /* Window to Use */
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
char *str; /* Where to Place Input */
char *def; /* Default String */
Created: 10/19/86 Last Updated: 10/19/86
Author: Bob Pritchett Source (C/A): C
Located in: WFINPUT.OBJ
Requires: wgotoxy() cfield()
Description:
This function displays the specified field in the window along
with the default string. A string may be inputted or the default
returned in the same manner as with finptstrd().
Compiler Specifics:
None.
Return Value:
A pointer to a duplicate of the inputted string, or the default,
is returned, via strdup().
See Also:
inptstrd() wfinptint() wfinptstred() ffill() finptstrd()
wfinptstre()
Example:
char temp[80];
int w;
w = wopen(10,10,20,70,4);
wfinptstrd(w,5,5,25,temp,"C Spot Run");
wfinptstre
Summary:
int wfinptstre(w,rw,cl,mx,str);
int w; /* Window to Use */
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
char *str; /* Where to Place Input */
Created: 10/19/86 Last Updated: 10/19/86
Author: Bob Pritchett Source (C/A): C
Located in: WFINPUT.OBJ
Requires: wfinptstred()
Description:
This function calls wfinptstred() with a null string as the
default argument. It will continue to do so until an input is
made.
Compiler Specifics:
None.
Return Value:
Nothing is returned.
See Also:
inptstr() finptstr() wfinptint() wffill() wfinptstr()
wfinptstred() finptstre()
Example:
char temp[80];
int w;
w = wopen(2,2,20,78,5);
wfinptstre(w,10,10,25,temp);
wprintf(w,"temp contains: >%s<\n");
wfinptstred
Summary:
int wfinptstred(w,rw,cl,mx,str,def);
int w; /* Window to Use */
int rw; /* Row of Field */
int cl; /* Column of Field */
int mx; /* Length of Field */
char *str; /* Where to Place Input */
char *def; /* Default String */
Created: 10/19/86 Last Updated: 10/19/86
Author: Bob Pritchett Source (C/A): C
Located in: WFINPUT.OBJ
Requires: wgotoxy() cfield()
Description:
This function behaves as does finptstred() with the exception
that it works within a window. Due to the complexity of this
routine and the fact that it is functionally identical to
finptstred() the complete description is not repeated here.
Compiler Specifics:
None.
Return Value:
A one is returned unless input was terminated by a special key,
in which case its value will be returned. (Special keys return a
null followed by an integer. The integer is returned here.)
See Also:
inptstr() wfinptint() wfinptstred() wffill() wfinptstr()
finptstred()
Example:
char temp[80];
int x;
int w;
w = wopen(4,4,20,70,5);
x = wfinptstred(w,10,10,25,temp,"C Spot Run");
if ( x != 1 ) /* Special Value */
proccess(x); /* Proccess Key */
wfinptyn
Summary:
int wfinptyn(w,rw,cl);
int w; /* Window to Use */
int rw; /* Row of Field */
int cl; /* Column of Field */
Created: 10/19/86 Last Updated: 10/19/86
Author: Bob Pritchett Source (C/A): C
Located in: WFINPUT.OBJ
Requires: wgotoxy() cfield()
Description:
This function behaves as does finptyn(), only within a window. A
description of how it functions is available under the finptyn()
heading.
Compiler Specifics:
None.
Return Value:
A one or a zero for a 'Y' or an 'N'.
See Also:
inptyn() finptyn() wfinptint() wffill() wfinptstr() wfinptynd()
Example:
char temp[80];
int w;
w = wopen(1,1,23,78,' ');
wfinptyn(w,10,10);
wfinptynd
Summary:
int wfinptynd(w,rw,cl,def);
int w; /* Window to Use */
int rw; /* Row of Field */
int cl; /* Column of Field */
int def; /* Default Input */
Created: 10/19/86 Last Updated: 10/19/86
Author: Bob Pritchett Source (C/A): C
Located in: WFINPUT.OBJ
Requires: wgotoxy() cfield()
Description:
This function behaves within a window in a manner similar to that
of finptynd(), where a complete description of the both functions
can be found.
Compiler Specifics:
None.
Return Value:
A one or a zero for a 'Y' or an 'N', or whatever the default was.
See Also:
inptynd() finptynd() wfinptint() wffill() wfinptstr() wfinptyn()
Example:
char temp[80];
int w;
w = wopen(12,12,20,70,'+');
wfinptynd(w,10,10,1); /* Default to Yes */
wfreeze
Summary:
int wfreeze(num,top,bot);
int num; /* Pointer to Window to Use */
int top; /* First Scrollable Line */
int bot; /* Last Scrollable Line */
Created: 04/16/86 Last Updated: 04/16/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This routine allows you to set the scrollable lines within a
window. When text a newline is printed on the last line inside a
window, the text scrolls up. This routine allows you to 'freeze'
a number of lines at the top and bottom of the window. The
numbers specified are the first and last scrollable lines, and
the default, full window, values are 0 and wrow(num).
No error checking is performed on the values.
The wcls() routine will only clear scrollable lines, and whome()
will home the cursor to the first character on the first
scrollable line. Reset the wfreeze() values to 0 and wrow(num)
to clear an entire window.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
Example:
wfreeze(w2,2,wrow(w2)-3); /* Freeze lines 0-1 at top, and the
bottom three lines. */
wgotoxy
Summary:
int wgotoxy(num,row,col);
int num; /* Pointer to Window to Use */
int row; /* Row In Window to Go To */
int col; /* Col In Window to Go To */
Created: 03/03/86 Last Updated: 04/16/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This routine perfomrs the same function as gotoxy() within window
coordinates. Remember that as on the screen, window coordinates
start numbering at 0,0.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
gotoxy() whome()
Example:
wgotoxy(w1,2,4); /* Put cursor at 2,4 in window 1. */
whline
Summary:
int whline(wind,row);
int wind; /* Window to Draw in */
int row; /* Row to Draw Line on */
Created: 03/03/86 Last Updated: 03/03/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: chline()
Description:
This function calls chline() with the correct parameters to draw
a horizontal line in the specified window. The correct colors
and border styles are used.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
chline() wvline()
Example:
#include <color.h> /* Just for the colors... */
int w;
w = wopen(5,5,20,60,1); /* A box with a single line border */
whline(w,7); /* Draws a line across the box */
whome
Summary:
int whome(num);
int num; /* Pointer to Window to Use */
Created: 04/20/86 Last Updated: 04/20/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This routine homes the cursor to the same coordinates as would be
used in a window clear with wcls(), the upper left scrollable
character in the specified window.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
gotoxy() wgotoxy()
Example:
wfreeze(w,3,wrow(num)); /* First three lines frozen. (0-2) */
whome(w); /* Cursor goes to 3,0. */
winptint
Summary:
int winptint(w,prompt);
int w; /* Window to Input Within */
char *prompt; /* Prompt for Input */
Created: 08/16/86 Last Updated: 08/16/86
Author: Bob Pritchett Source (C/A): C
Located in: WINPUT.OBJ
Requires: Nothing.
Description:
This function performs the same function as inptint() only within
the specified window.
Compiler Specifics:
None.
Return Value:
The integer inputted.
See Also:
inptint() winptintd() winptintr() winptintrd()
Example:
int w;
w = wopen(2,5,10,76,3);
wprintf(w,"winptint() returns: %d.\n"
,winptint(w,"Enter Integer:"));
/* The above function prompts "Enter Integer: " and then */
/* executes the wprintf statement. */
winptintd
Summary:
int winptintd(w,prompt,def);
int w; /* Window to Input Within */
char *prompt; /* Prompt for Input */
int def; /* Default Integer */
Created: 08/16/86 Last Updated: 08/16/86
Author: Bob Pritchett Source (C/A): C
Located in: WINPUT.OBJ
Requires: Nothing.
Description:
This functions prompts and waits for an integer, or a carriage
return, in which case it returns the default integer. Refer to
inptintd() for details.
Compiler Specifics:
None.
Return Value:
The integer inputted, or the default.
See Also:
inptintd() winptint() winptintr() winptintrd()
Example:
int w;
w = wopen(4,1,8,78,2);
wprintf(w,"winptintd() returns: %d.\n"
,winptintd(w,"Enter Integer:",7));
/* The above function prompts "Enter Integer: " and then */
/* executes the wprintf statement. */
winptintr
Summary:
int winptintr(w,prompt,low,high);
int w; /* Window to Input Within */
char *prompt; /* Prompt for Input */
int low; /* Lowest Acceptable Input */
int high; /* Highest Acceptable Input */
Created: 08/16/86 Last Updated: 08/16/86
Author: Bob Pritchett Source (C/A): C
Located in: WINPUT.OBJ
Requires: Nothing.
Description:
Performing in the same manner as inptintr() this function prompts
for an integer within a range and waits until a valid one is
received. For details refer to inptintr().
Compiler Specifics:
None.
Return Value:
The integer inputted, within the specified range.
See Also:
inptintr() winptint() winptintd() winptintrd()
Example:
int w;
w = wopen(1,1,20,78,1);
wprintf(w,"winptintr() returns: %d.\n",winptintr(w
,"Enter Integer:",5,62));
/* The above function prompts "Enter Integer: " and then */
/* executes the wprintf statement. The returned value */
/* will be greater than 4 and less than 63. */
winptintrd
Summary:
int winptintrd(w,prompt,low,high,def);
int w; /* Window to Input Within */
char *prompt; /* Prompt for Input */
int low; /* Lowest Acceptable Input */
int high; /* Highest Acceptable Input */
int def; /* Default Value */
Created: 08/16/86 Last Updated: 08/16/86
Author: Bob Pritchett Source (C/A): C
Located in: WINPUT.OBJ
Requires: Nothing.
Description:
Behaving as does inptintrd() this function prompts within the
specified window with the default integer and waits until a
carriage return is hit, in which case the default is returned, or
an integer within the specified range is entered.
Compiler Specifics:
None.
Return Value:
The integer inputted, or the default, within the specified range.
See Also:
inptintrd() winptint() winptintd() winptintr()
Example:
int w;
w = wopen(2,2,10,70,5);
wprintf(w,"winptintrd() returns: %d.\n"
,winptintrd(w,"Enter Integer:",8,50,30));
/* The above function prompts "Enter Integer: 30" and */
/* then executes the wprintf statement. The returned */
/* value will be greater than 7 and less than 51. */
winptstr
Summary:
char *winptstr(prompt);
int w; /* Window to Input Within */
char *prompt; /* Prompt for Input */
Created: 08/25/86 Last Updated: 08/25/86
Author: Bob Pritchett Source (C/A): C
Located in: WINPUT.OBJ
Requires: Nothing.
Description:
This function is the window equivalent of inptstr(). It
functions in an identical manner with the exception that the
prompt and input are within the window.
Compiler Specifics:
None.
Return Value:
The character string inputted.
See Also:
inptstr() winptstrd() wfinptstr() wfinptstrd() wfinptstre()
wfinptstred()
Example:
int w;
w = wopen(2,2,20,78,'*'); /* Border of *'s. */
wprintf(w,"Hello there, %s.\n",winptstr(w,"Your name?"));
winptstrd
Summary:
char *winptstrd(win,prompt,def);
int win; /* Window to Input Within */
char *prompt; /* Prompt for Input */
char *def; /* Default String */
Created: 08/25/86 Last Updated: 08/25/86
Author: Bob Pritchett Source (C/A): C
Located in: WINPUT.OBJ
Requires: Nothing.
Description:
This function performs like winptstr() with the exception that it
prompts with a default string that is returned if a carriage
return is entered as the first keystroke. For more information
see inptstrd().
Compiler Specifics:
None.
Return Value:
The character string inputted, or the default string.
See Also:
inptstrd() winptstr() wfinptstr() wfinptstrd() wfinptstre()
wfinptstred()
Example:
int w;
w = wopen(4,2,10,76,2);
wprintf(w,"Hello there, %s.\n"
,winptstrd(w,"Your name?","Robert"));
winptyn
Summary:
char *winptyn(win,prompt);
int win; /* Window to Prompt Within */
char *prompt; /* Prompt for Input */
Created: 08/16/86 Last Updated: 08/16/86
Author: Bob Pritchett Source (C/A): C
Located in: WINPUT.OBJ
Requires: Nothing.
Description:
This function behaves in the same manner as inptyn(), prompting
and waiting for a yes or no response.
Compiler Specifics:
None.
Return Value:
A one or zero, dependent on the inputted character.
See Also:
inptyn() winptynd() wfinptyn() wfinptynd()
Example:
if ( winptyn(w,"Do you program microcomputers?") )
wprintf(w,"Oh, you do.");
/* Prompts 'Do you program microcomputers? (Y/N) ' */
winptynd
Summary:
char *winptynd(win,prompt,x);
int win; /* Window to Input Within */
char *prompt; /* Prompt for Input */
int x; /* Default Answer */
Created: 08/16/86 Last Updated: 08/16/86
Author: Bob Pritchett Source (C/A): C
Located in: WINPUT.OBJ
Requires: Nothing.
Description:
This function performs identically to winptyn() except that the
default response is the capital letter, and is returned if a
carriage return is entered.
Compiler Specifics:
None.
Return Value:
A one or zero, dependent on the inputted character, or the
default.
See Also:
inptynd() winptyn() wfinptyn() wfinptynd()
Example:
if ( winptyn(w,"Do you program microcomputers?",1) )
wprintf(w,"Oh, you do.");
/* Prompts 'Do you program microcomputers? (Y/n) ' */
winsert
Summary:
int winsert(num,row,tms)
int num; /* Pointer to Window to Use */
int row; /* Row to Insert Line Before */
int tms; /* Number of Lines to Insert */
Created: 04/30/86 Last Updated: 04/30/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This routine inserts tms lines before the specified line in the
specified window, scrolling all lines below down tms. The cursor
goes to the first column in the first new line.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
wdelete() wblank()
Example:
winsert(win,3,2); /* Insert two lines before line 3,
new lines become 3 and 4, 3 becomes
line 5. */
wjump
Summary:
int wjump(wind,x,y);
int wind; /* Pointer to Window to Jump */
int x; /* Upper Right Row */
int y; /* Upper Right Col */
Created: 03/03/86 Last Updated: 03/09/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function activates and moves the specified window to the x,y
coordinates given. The window instantly 'jumps', placing it's
upper right hand corner at x,y.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
wmove()
Example:
wjump(w2,10,10); /* Jumps window w2 to 10,10 */
wmessage
Summary:
int wmessage(win,str,val);
int win; /* Window to Use */
char *str; /* Message to Use */
int val; /* Message Location */
Created: 03/03/86 Last Updated: 03/03/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: wprint()
Description:
Using the window's border attribute, this function prints a
message to the user on the bottom border. For more information
see the description of wtitle().
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
wtitle()
Example:
wmessage(w,"< Press a Key >",0);
wmove
Summary:
int wmove(wind,dir);
int wind; /* Pointer to Window to Move */
int dir; /* Direction to Move Window */
Created: 03/03/86 Last Updated: 03/09/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function will activate and move the specified window one
space in the direction given in dir. The dir value is a number
from one to four, up, right, down, and left, respectively.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
wjump()
Example:
wmove(w2,10,10); /* Jumps window w2 to 10,10 */
wopen
Summary:
int wopen(x,y,x2,y2,type);
int x; /* Upper Left Row */
int y; /* Upper Left Col */
int x2; /* Lower Right Row */
int y2; /* Lower Right Col */
int type; /* Type of Border */
Created: 03/03/86 Last Updated: 03/09/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: cbox()
Description:
This function opens a video window. The current video attributes
are used, the portion of the screen covered is saved, and then
blanked with the interior color. The argument type may be of any
one of the valid types used by box() and cbox().
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Returns a type int value needed to reference the window at a
later time.
See Also:
wclose() wactivate()
Example:
int w;
w = wopen(10,10,20,70,2); /* Open a large window */
wprint
Summary:
int wprint(win,str);
int win; /* Window to Use */
char *str; /* String to Print */
Created: 03/03/86 Last Updated: 03/03/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: putchci()
Description:
Using the window's inside attributes, the string is printed at
the current cursor position within the specified window, which is
activated if it is not already so. The following escape
characters may be used:
\n Newline
\t Tab
\r Return
\f Form-Feed, clear window
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
wprintf()
Example:
wprint(w3,"This line is outputted where the cursor is.\n");
wprintf
Summary:
int wprintf(win,str,args...);
int win; /* Window to Use */
char *str; /* Formatted String to Print */
args... /* Formatting Arguments */
Created: 03/09/86 Last Updated: 08/17/86
Author: Bob Pritchett Source (C/A): C
Located in: WPRINTF.OBJ
Requires: wprint()
Description:
This function supports the full formatting capabilities of the
regular printf() function, only it prints to the specified
window. A maximum of 15 formatting arguments may be included, it
is unlikely more should be needed.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
wprint()
Example:
wprintf(w2,"This is formatting... %03d %s.\n",38,"times");
wputat
Summary:
int wputat(win,x,y,string);
int win; /* Window to Use */
int x; /* Row to Print on */
int y; /* Column to Print at */
char *string; /* String to Print */
Created: 03/09/86 Last Updated: 03/09/86
Author: Bob Pritchett Source (C/A): C
Located in: WPUTAT.OBJ
Requires: wgotoxy() wprint()
Description:
This routine will place the string in the window specified at the
coordinates specified. If not active the specified window will
be activated.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
putat()
Example:
wputat(win,4,5,"+ The plus sign is at 4,5 in window win.");
wputatf
Summary:
int wputatf(num,row,col,string,args...)
int num; /* Pointer to Window to Use */
int row; /* Row Coordinate */
int col; /* Col Coordinate */
char *string; /* Format String */
args... /* Formatting Arguments */
Created: 05/01/86 Last Updated: 08/17/86
Author: Bob Pritchett Source (C/A): C
Located in: WPUTATF.OBJ
Requires: Nothing.
Description:
This routine performs the same function as putatf() only within
the specified window.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
putatf() wputat() putat()
Example:
wputatf(win,4,6,"This line at %d,%d.",4,6);
wputchar
Summary:
int wputchar(num,c);
int num; /* Number of Window to Use */
int c; /* Character to Output in Window */
Created: 04/25/86 Last Updated: 04/25/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function simply outputs the character at the current
position of the specified window.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
wprint() wprintf()
Example:
wputchar(win,'\n');
wrow
Summary:
int wrow(wind);
int wind; /* Pointer to Window to Use */
Created: 03/03/86 Last Updated: 03/09/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function returns the number of the highest row in a window.
If a window has four lines, numbered zero to three, wrow() will
return a three. Mostly an internal routine.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
wcol()
Example:
x = wrow(w3); /* Returns the number of highest row */
wscolor
Summary:
#include <color.h> /* For Color Defintitions Only */
int wscolor(wind,insd,bord);
int wind; /* Pointer to Window to Use */
int insd; /* New Color For Window Insides */
int bord; /* New Color For Window Border */
Created: 09/14/86 Last Updated: 09/14/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function is the equivalent of wcolor() except that it has an
affect only on the specified window. It does not change the
current color of the windows, but rather all subsequent output in
that window.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
wcolor() wcolor()
Example:
#include <color.h>
int w;
wcolor(RED_F,BLU_F);
w = wopen(10,10,20,20,1);
wprint(w,"This is some output.\n"); /* In red. */
wscolor(w,GRN_F,WHT_F);
wprint(w,"This text is in green, and any border manipualtion\n");
wprint(w,"will be in white from now on, in this window.\n");
wscroll
Summary:
int wscroll(num,dir,tms)
int num; /* Number of Window to Use */
int dir; /* Direction to Scroll in */
int tms; /* Number of Lines to Scroll */
Created: 03/03/86 Last Updated: 03/03/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: Nothing.
Description:
This function will scroll the specified window tms lines in the
specified window. The direction is 0 for up, or 1 for down.
Specifying 0 lines will clear the window.
Compiler Specifics:
Compiled with MSC. See window notes.
Return Value:
Nothing.
See Also:
scroll()
Example:
wscroll(win,0,1);
wtitle
Summary:
int wtitle(win,str,val);
int win; /* Window to Use */
char *str; /* Title to Use */
int val; /* Title Location */
Created: 03/03/86 Last Updated: 03/03/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: wprint()
Description:
This routine will place a string along the top border of the
specified window in either the center, on the left, or on the
right. To specify the location, val is 0, center, 1, left, or 2,
right. The window's border attribute is used.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
wmessage()
Example:
wtitle(w,"[ Window 1 ]",1);
wvline
Summary:
int wvline(wind,col);
int wind; /* Window to Use */
int col; /* Column for the Line */
Created: 03/03/86 Last Updated: 03/03/86
Author: Bob Pritchett Source (C/A): C
Located in: COUTPUT.OBJ
Requires: cvline() putchci() gotoxy()
Description:
This function calls cvline() with the correct parameters to draw
a vertical line in the specified window. The correct colors and
border styles are used.
Compiler Specifics:
None.
Return Value:
Nothing.
See Also:
cvline() whline()
Example:
#include <color.h> /* Just for the colors... */
int w;
w = wopen(5,5,20,60,1); /* A box with a single line border */
wvline(w,10); /* Draws a line down the box */
zero_tmr
Summary:
void zero_tmr(x);
int x; /* The Number of the Counter to Use */
Created: 01/03/87 Last Updated: 01/03/87
Author: Dave Perras Source (C/A): C
Located in: TIMERS.C TIMERS.OBJ
Requires: get_timer()
Description:
This function sets the specified timer to the current value of
the real time clock, effectively 'zeroing' the counter.
Compiler Specifics:
None.
Return Value:
Nothing is returned.
See Also:
get_timer() start_tmr() stop_tmr() read_tmr() reset_tmr() timer()
init_tmr()
Example:
init_tmr(); /* Initialize Timers */
start_tmr(5); /* Start timer number 5. */
printf("%d seconds have elapsed.\n",10 * read_tmr(5));
/* The above statement does not stop the timer. */
zero_tmr(5); /* Zero the timer to the current */
/* time. */
CheckC
Summary:
Created: 12/25/85 Last Updated: 09/16/86
Author: Bob Pritchett Source: C
Syntax: CheckC [/A] <source> [<source>...]
Documentation:
CheckC
A Small C Code Checker.
Copyright 1985, 1986 Bob Pritchett
New Dimension Software
Version 2.1 - Documentation
CheckC has come quite some distance since version 1.3 was
released with the first version of C Spot Run. It now supports
an analysis mode with full error recovery, and is better
implemented over all.
CheckC started as a simple bracket counter type program,
checking to make sure brackets, quotes, etc, all were present in
even numbers. And the present time it can analyze a file and
report syntactical errors to, on average, within two lines, and
then recover in order to find any subsequent errors, assuming the
one just found was corrected.
CheckC may be invoked with as many file names as DOS allows,
and will check each one in order for matching pairs of all
relevant characters, quotes, and comments. The real power is
displayed when it is invoked with a /A as the first argument,
followed by the file names. In this case a rather comprehensive
(for a character oriented program) syntax check will be executed,
with errors and problem spots reported in the format of line
number followed by error description.
CheckC knows when to and when not to be checking syntax.
While in comments, everything but an end of comment is ignored.
(NOTE! CheckC does NOT allow for nested comments, in accordance
with K&R.) The same applies to quoted strings, with the added
contitions that CheckC is aware of when to ignore quotes (as in
escape sequences), and when they may be missing. (When a newline
is found in a quoted string a warning is generated indicating
that further analysis may be incorrect.) Single quotes are
processed under the rule that only one character is allowed
between them, the maximum physical characters being two in the
case of an escape sequence.
CheckC's analysis will sometimes refer to errors concerning
functions or blocks. CheckC refers to any code one bracket level
deep as a function, and any code several brackets deep as a
block. Unfortunatly, as you may open a virtually unlimited
number of blocks, a missing open bracket can only be detected
when the number of closing brackets exceeds the number of opening
ones. In such a case an error is noted, the missing character
assumed, and analysis continued. By noting funtion vs. block in
the error, and tracing structured code up from the line number,
the missing (or extra) bracket can easily be found.
Another way of finding mismatched characters as soon as
possible is looking for semicolons within them. Anytime a
semicolon is found within a set of parenthesis or square
brackets, chances are that there is a missing closing character
within a few lines of it. (Semicolons within for() statements
will not cause this error flag.)
If a comment is left open, causing the rest of the file to
go un-analyzed, a line number will be reported with the error at
when end of file is reached. This is the line on which last
found comment was opened, and from there the error should be
obvious.
On the whole, CheckC's errors are self explanatory, and in
all testing so far it has been perfectly accurate. It is much
more likely to report a few extra errors when recovery is not
complete then to miss any. Without the analysis mode it is
severly crippled, and it is recommended that you use the /A flag
with everything unless your code varies from K&R enough to cause
false errors.
I'd appreciate it if you could report any bugs or
suggestions, and let me know how you like it. Good luck!
FLine
Summary:
Created: 03/02/86 Last Updated: 03/03/86
Author: Bob Pritchett Source: C
Syntax: FLine <source> <dest>
Documentation:
FLine
A Structured Programming Utility
Copyright 1986 Bob Pritchett
New Dimension Software
Version 1.1 - Documentation
FLine is a programming tool that goes through source code
and places all lines beginning with a non-whitespace character
into the specified output file. This creates a useful reference
file containing a list of all function declarations, including
arguments, global variables, comments, and pre-processor
directives. (This assumes, of course that you indent the actual
code within your source file.)
FLine is called as:
FLine <source> <dest>
Where <source> is the source code to process and <dest> is
the name of the file to place the output in. Note that whatever
is in <dest> is erased and replaced with FLine's output.
CSRSHELL.ASM
Summary:
Created: 09/10/86 Last Updated: 09/10/86
Author: Various
Documentation:
CSRShell.ASM is a small file that contains a complete shell
for writing assembly interfaces to Microsoft C. (In the planning
stages are additions for contitional assembly for other
compilers.) Things such as large and small model assembly,
argument reading, stack setup and more are included and
explained.
To make use of the shell, copy it into another appropriately
named file, insert the correct function name over _shell
(remember to preserve the underscore, MSC needs it), replace the
two dummy argument reads with your assembly source, and place
your data in the appropriate place.
COLOR.H
Summary:
Created: 04/14/86 Last Updated: 09/20/86
Author: Bob Pritchett
Description:
This include file contains the define statements for all the
color attributes possible in text. The colors are listed with a
three letter name followed by a _ and F or B signifying fore or
background attribute. To get a full attribute, add a fore and
background color. (BLU_F+RED_B)
Also included are definitions for BOLD (which is added to an
attribute to intensify it), NORMAL (white on black), and several
others. (NOTE: Some of the attriutes are for monochrome
displays only, for example, UNDERLINE shows as blue on a color
screen, and REVERSE as black on white.)
For a list of all the colors and their abbreviations look at the
header file.
CSRDOS.H
Summary:
Created: 04/04/86 Last Updated: 04/04/86
Author: Bob Pritchett and Alan Losoff
Description:
This header file contains structures and #define statements
needed by functions accessing DOS 2.0 functions.
CSRMENU.H
Summary:
Created: 08/08/86 Last Updated: 08/16/86
Author: Bob Pritchett
Description:
This header file contains the typdef statement to create the MENU
data type needed for the function pmenu(). The structure is as
follows:
typedef struct _mnu
{
char title[23]; /* Title of the menu */
int type; /* Style of the border */
int border; /* Window's border color */
int normal; /* Color for unhighlighted items */
int bar; /* Color for the highlight bar */
int row; /* Upper left window row */
int col; /* Upper left window column */
int num; /* Number of enteries */
struct _ent
{
char text[25]; /* Item's name */
int value; /* Return value for item / -1 Static */
} entry[MAX_ENTRIES];
} *MENU;
CSRMISC.H
Summary:
Created: 04/20/86 Last Updated: 12/05/86
Author: Bob Pritchett
Description:
This header file contains dummy(), iswild(), and the defintions
for the min() and max() macros which were ommitted from
Microsoft's standard library.
CSRMODES.H
Summary:
Created: 05/05/86 Last Updated: 05/05/86
Author: Bob Pritchett
Description:
This header file contains define statements for the different
video modes. It is intended to be used with set_mode().
CSRSOUND.H
Summary:
Created: 08/07/86 Last Updated: 08/07/86
Author: Bob Pritchett (Data from Norton's Book.)
This header file contains note definitions for use with the
sound() routine in CSRSOUND.OBJ.
CSRTIME.H
Summary:
Created: 05/05/86 Last Updated: 04/20/86
Author: Bob Pritchett
This file contains two static char * arrays containing the names
of the days of the week and the days of the month. The days of
the week start with Sunday, the months start with a null and then
January as the second entry, element one, to allow compatibility
with the way DOS returns the date.
ERRORS.H
Summary:
Created: 05/05/86 Last Updated: 05/05/86
Author: Bob Pritchett (Data from Norton's Book.)
This file contains a static char * array containing the DOS
errors returned in AX after a DOS function call. These errors
are for DOS 2.X alone, and do not apply to DOS 3.X extended error
codes. Error descriptions start with element one.
SKEY.H
Summary:
Created: 02/22/86 Last Updated: 02/22/86
Author: Bob Pritchett (Data from Norton's Book.)
Description:
This header file contains #define statements for all of the
special keys and combinations on the keyboard. These values are
those returned as extened codes, after a null is read. They are
in the basic format of KEY1KEY2, or simply Fx for function keys.
(Note: Function keys are numbered through 40, 1-10 are normal
keys, 11-20 are shift keys, 21-30 are ctrl keys, and 31-40 are
alt keys. As in Shift-F2 returns F12.)
C Spot Run - Documentation
Appendix A - Updating the Library
The C Spot Run routine library is constantly being added to
as we receive contributions and write more routines ourselves.
In the interest of saving time and space, library updates will
come in one of two forms.
First, small collections of new routines, or single
routines, will be placed in archives along with a single page of
documentation and distributed via BBSs. Registered users will
receive information about new updates or a copy of those updates.
When you receive an update archive you simply place the files
into your library or linking directory and print out the
documentation page, which is then inserted in alphabetical order
into the library description section of this manual. (This is
why those pages are not numbered and we recommend storing your
manual in a three ring binder.)
Second, major updates to the entire library will be
distributed in archives containing all the routines, and a
totally new version of the complete manual. These updates will
be on new version numbers.
To keep on top of changes to the library it is suggested
that you read issues of the C Spot Run Newsletter as it is
released, and make an occasional call to the support BBS where
the latest version of the library and newsletter are always
available.
C Spot Run - Documentation
Appendix B - Contacting Authors
Each description page mentions the name of the author of
that routine, utility, or aid. If for some reason you would like
to contact that author you may check the following directory for
addresses and possibly phone numbers. (NOTE: All of the
following authors voluntarily placed their addresses and
sometimes their phone numbers in this directory. They have
indicated a willingness to answer questions by doing this, but we
ask you to be considerate with you calling hours and keep in mind
differences in time zones.)
Mongelluzzo, Philip A. (203) 574-2326 - Voice
273 Windy Drive (203) 271-1579 - Data (300/1200B)
Waterbury, CT 06705
Pritchett, Bob (609) 424-2595 - Voice
23 Pawtucket Drive (609) 354-9259 - Data (300-2400B)
Cherry Hill, NJ 08003 FidoNet: 107/414
Roukas, George
C/O Pinelands BBS (609) 354-9259 - Data (300-2400B)
C Spot Run - Documentation
Appendix C - Submitting Routines or Utilities
All submissions to the routine library or utility collection
should be made using the Routine/Utility Submission Form, and
should be sent to the address on that form. Please do not make
additions to the library or utility collection on your own, this
creates a problem and complicates the distribution.
In addition to the following form please enclose a
description of the routine or utility, preferably on an IBM PC
disk (360K or 1.2Meg). Please make this description in the
appropriate format as specified in sections 4.1 and 4.2 of this
manual.
C Spot Run - Documentation
Appendix D - History of Versions and Changes
01/10/87 - Version 2.0 of the library released with new
features and a new newsletter.
10/13/86 - Limited release of version 1.1 of the library to
some registered users. Most bugs fixed, manual updated, new
routines.
06/27/86 - First issue of the newsletter released.
05/05/86 - Version 1.0 of the library released.
C Spot Run - Documentation
Appendix E - ASCII Table
Dec Hex Chr Dec Hex Chr Dec Hex Chr
--- --- --- --- --- --- --- --- ---
0 00 NUL 43 2B + 86 56 V
1 01 SOH 44 2C , 87 57 W
2 02 STX 45 2D - 88 58 X
3 03 ETX 46 2E . 89 59 Y
4 04 EOT 47 2F / 90 5A Z
5 05 ENQ 48 30 0 91 5B [
6 06 ACK 49 31 1 92 5C \
7 07 BEL 50 32 2 93 5D ]
8 08 BS 51 33 3 94 5E ^
9 09 HT 52 34 4 95 5F _
10 0A LF 53 35 5 96 60 `
11 0B VT 54 36 6 97 61 a
12 0C FF 55 37 7 98 62 b
13 0D CR 56 38 8 99 63 c
14 0E SO 57 39 9 100 64 d
15 0F SI 58 3A : 101 65 e
16 10 DLE 59 3B ; 102 66 f
17 11 DC1 60 3C < 103 67 g
18 12 DC2 61 3D = 104 68 h
19 13 DC3 62 3E > 105 69 i
20 14 DC4 63 3F ? 106 6A j
21 15 NAK 64 40 @ 107 6B k
22 16 SYN 65 41 A 108 6C l
23 17 ETB 66 42 B 109 6D m
24 18 CAN 67 43 C 110 6E n
25 19 EM 68 44 D 111 6F o
26 1A SUB 69 45 E 112 70 p
27 1B ESC 70 46 F 113 71 q
28 1C FS 71 47 G 114 72 r
29 1D GS 72 48 H 115 73 s
30 1E RS 73 49 I 116 74 t
31 1F US 74 4A J 117 75 u
32 20 75 4B K 118 76 v
33 21 ! 76 4C L 119 77 w
34 22 " 77 4D M 120 78 x
35 23 # 78 4E N 121 79 y
36 24 $ 79 4F O 122 7A z
37 25 % 80 50 P 123 7B {
38 26 & 81 51 Q 124 7C |
39 27 ' 82 52 R 125 7D }
40 28 ( 83 53 S 126 7E ~
41 29 ) 84 54 T 127 7F DEL
42 2A * 85 55 U
C Spot Run - Documentation
Appendix F - Window Border Styles
Type 1 Type 2
+--------+ +========+
| | | |
+--------+ :========:
| | | |
+--------+ +========+
Type 3 Type 4
++======++ ++------++
|| || || ||
|:======:| |+------+|
|| || || ||
++======++ ++------++
Type 5
The actual plus and minus characters will
be used, resulting in a display identical to
the non graphic representation of type number 1.
Any Other Character
If any other character is used as the type
argument, that character will be used for the border.
C Spot Run - Documentation
Quick Reference Chart
Control-Break Routines
----------------------------------------
cbcapt() cbrest()
Cursor Control Routines
----------------------------------------
current_page() cursor_off() cursor_on() cursor_read()
cursor_size() gotoxy() restore_cursor()
save_cursor()
Date Manipulation Routines
----------------------------------------
chk_date() date_sn() day_of_year() dt_diff()
isleap() month_day() sn_date() valid_date()
Disk Drive Routines
----------------------------------------
dirwin() ffirst() fnext() get_drive()
num_drives() set_drive()
Field Input Routines
----------------------------------------
cfield() fchar() fcolor() ffill()
finptint() finptintd() finptintr() finptintrd()
finptstr() finptstrd() finptstre() finptstred()
finptyn() finptynd()
Graphics Routines
----------------------------------------
gback() gbox() gcircle() gdot()
gfbox() ginit() gline() gpal()
Input Routines
----------------------------------------
inptint() inptintd() inptintr() inptintrd()
inptstr() inptstrd() inptyn() inptynd()
Miscellaneous Routines
----------------------------------------
dosver() getpw() istemplate() itofa()
ltofa() mcolor() sound() soundex()
Printer Routines
----------------------------------------
lprint() lprintf() lputchar() print_screen()
prtrns()
Screen Control and Output Routines
----------------------------------------
border() box() cbox() ccenter()
ccls() ccputs() center() centerf()
cfield() chline() cls() cvline()
message() mscroll() pmenu() pop_menu()
C Spot Run - Documentation
putat() putatf() putchc() putchci()
restore() restore_screen() save()
save_screen() scroll() set_mode() vidblt()
String Routines
----------------------------------------
match() soundex() strcen() strght()
strlft() strtrm()
System Clock Routines
----------------------------------------
get_date() get_dow() get_time() set_date()
set_time()
Timer Routines
----------------------------------------
get_timer() init_tmr() read_tmr() reset_tmr()
start_tmr() stop_tmr() timer() zero_tmr()
Window Routines
----------------------------------------
cmenu() color() dma() fixcolor()
retrace() wactivate() wblank() wborder()
wcenter() wcenterf() wclose() wcloseall()
wcls() wcol() wcolor() wdelete()
wfreeze() wgotoxy() whline() whome()
winsert() wjump() wmessage() wmove()
wopen() wprint() wprintf() wputat()
wputatf() wputchar() wrow() wscolor()
wscroll() wtitle() wvline()
Window Field Input Routines
----------------------------------------
wcfield() wfchar() wfcolor() wffill()
wfinptint() wfinptintd() wfinptintr() wfinptintrd()
wfinptstr() wfinptstrd() wfinptstre() wfinptstred()
wfinptyn() wfinptynd()
Window Input Routines
----------------------------------------
winptint() winptintd() winptintr() winptintrd()
winptstr() winptstrd() winptyn() winptynd()
Routine/Utility Submission Form
Name of Routine/Utility: ___________________________________
Form(s) of Submission (C/ASM/OBJ/LIB/EXE/COM): _____________
Are you releasing this routine/utility to the Pubic Domain
or under another program? (PD/Program): ___________________
If this release is under a voluntary contribution program,
what is the suggested contribution? ($): ___________________
May we put your address in the author directory? (Y/N): ____
Your phone number? (Y/N): ____
Your data address? (Y/N): ____
Name: _________________________________
Address: _________________________________
City: _____________________ State: ____ ZIP: _________
Phone: ( ) - Hours: ____________________
Source ID: _______________ CompuServe ID: _________________
Data #: ( ) - Hours: ____________________
Fido Net: ____ /_____ Baud: ____________________
In submitting this form you place your routine or utility
into the C Spot Run C Add-on and Utility Library, and give
permission for it's use as specified in Appendix C and
sections one and two of this manual.
Please send this form via US Mail to the following address,
or via modem to the accompanying FidoNet address.
Don't forget the description sheets, and of course the files
you are submitting!
C Spot Run
New Dimension Software FidoNet 107/414
23 Pawtucket Drive Data: (609) 354-9259
Cherry Hill, NJ 08003
User Response Form
We would like to hear from you, and would appreciate any
comments, suggestions, and/or donations. Even if you are not
making a donation or contributing to the library, we would
appreciate some input, and it helps us to know if the library is
serving it's intended purpose, and gives us some information on
our users. Of course this is voluntary, but we hope you will
take the time to fill out and mail this form.
How did you obtain your copy of C Spot Run? ________________
____________________________________________________________
What, in your opinion, are the most useful routines and
utilities? _________________________________________________
What do you think of the documentation? ____________________
____________________________________________________________
Are you enclosing a contribution, and if so, how much and
why? _______________________________________________________
Do you have any comments and/or suggestions? _______________
____________________________________________________________
____________________________________________________________
Would you like to be on a possible mailing list? (Y/N) ____
Name: _________________________________
Address: _________________________________
City: _____________________ State: ____ ZIP: _________
Phone: ( ) - Hours: ____________________
Source ID: _______________ CompuServe ID: _________________
Data #: ( ) - Hours: ____________________
Fido Net: ____ /_____ Baud: ____________________
Thank you, we hope you find the C Spot Run library of use.
Please send this form via US Mail to the following address,
or via modem to the accompanying FidoNet address.
C Spot Run
New Dimension Software FidoNet 107/414
23 Pawtucket Drive Data: (609) 354-9259
Cherry Hill, NJ 08003
Order Form
NOTE: Users who receive source code may not redistribute
it. The code is for your use only, and the right to redistribute
is not included in the purchase. If two or more people will be
using the source, rather then ordering just one copy please
contact the author about a discount on several copies.
( ) I would like to register as a C Spot Run User, receive
complete source code on disk, update notifications, and be placed
on whatever mailing list may be formed. I am enclosing a $50
donation.
( ) I would like to register as a C Spot Run User and
receive all the benfits of such status with the exception of the
source code. I am enclosing a $10 donation.
Name: _________________________________
Address: _________________________________
City: _____________________ State: ____ ZIP: _________
Phone: ( ) - Hours: ____________________
Source ID: _______________ CompuServe ID: _________________
Data #: ( ) - Hours: ____________________
Fido Net: ____ /_____ Baud: ____________________
C Spot Run
New Dimension Software FidoNet 107/414
23 Pawtucket Drive Data: (609) 354-9259
Cherry Hill, NJ 08003
+-------------------- NDS USE ONLY --------------------+
| |
| Recieved: ____ /____ /____ Sent: ____ /____ /____ |
| |
| Serial Number: ________________ |
| |
+--------------------------------------------------------+